Spec Ops

All submissions for this problem are available.
You are given an array of length N.You are to perform certain operations on this array, these operations are of two types:
 Update a range [x...y]: In which you must divide each number in the given range [x...y] by 2.This division is integer division i.e 7/2 = 3
Note:The range [x...y] mentioned above is inclusive of both index x and y.
Input
The input starts with a single line containing N (1<=N<=10^{5}) the number of elements in the array. The next line contains N space separated integers which are the elements of the array.The elements of the array will be between 0 and 1000.
The next line will contain Q (1<=Q<=10^{5}) the number of operations to be applied.Each of the next Q lines contains the specification of a query.Each of these lines contains 3 integers, the first being 1 or 2 denoting that the operation is an update or query respectively. The next two integers X and Y which represent the range on which to update or query [X...Y]. It is guaranteed that X<=Y and that X,Y<=N.
Output
The output should consist of exactly that many lines as the number of Operations of type 2.Where each line consists of the answer of the corresponding query.
Example
Input: 5 1 1 1 1 5 5 2 1 5 1 1 2 2 1 5 1 5 5 2 1 5 Output: 9 7 4
Author:  amitrc17 
Tags  amitrc17 
Date Added:  14012014 
Time Limit:  0.1275 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, PYP3, CLOJ, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 