GSS4  Can you answer these queries IV
You are given a sequence A of N(N <= 100,000) positive integers. There sum will be less than 10^{18}. On this sequence you have to apply M (M <= 100,000) operations:
(A) For given x,y, for each elements between the xth and the yth ones (inclusively, counting from 1), modify it to its positive square root (rounded down to the nearest integer).
(B) For given x,y, query the sum of all the elements between the xth and the yth ones (inclusively, counting from 1) in the sequence.
Input
Multiple test cases, please proceed them one by one. Input terminates by EOF.
For each test case:
The first line contains an integer N. The following line contains N integers, representing the sequence A_{1}..A_{N}.
The third line contains an integer M. The next M lines contain the operations in the form "i x y".i=0 denotes the modify operation, i=1 denotes the query operation.
Output
For each test case:
Output the case number (counting from 1) in the first line of output. Then for each query, print an integer as the problem required.
Print an blank line after each test case.
See the sample output for more details.
Example
Input: 5 1 2 3 4 5 5 1 2 4 0 2 4 1 2 4 0 4 5 1 1 5 4 10 10 10 10 3 1 1 4 0 2 3 1 1 4 Output: Case #1: 9 4 6 Case #2: 40 26
hide comments
minhazul_islam:
20180420 07:28:30
@Riddhi EOF is == 1. While thinks it as TRUE. So, after getting the last number while loop won't stop. As a result scanf will try again to take a number but there is nothing left to take input in judge data. Thus you program will cause a RTE. Last edit: 20180420 07:28:54 

Riddhi:
20180419 11:31:55
didn't know that <while(scanf("%d", &n))> gives runtime error


mahmoud_16:
20180322 21:33:54
hello,can anyone make an editorial for this problem or poste his solution


sadman2901:
20180115 16:27:36
Good problem, learned new things :) 

kmkhan_014:
20171217 15:09:01
Last edit: 20180225 14:00:42 

dp_v1:
20171115 19:02:35
nice Ques. 

imperfectboy:
20171103 10:38:50
1 line changed TLE to AC !!!! Finally after 5TLE 

ititorit:
20170307 23:16:16
if(l > r) swap(l, r) > AC... OMG...


avisheksanvas:
20170227 14:14:38
Motto of this problem :


rihaz_zahir:
20170213 17:01:52
how to do the EOF function to take the inputs?? 
Added by:  Fudan University Problem Setters 
Date:  20080521 
Time limit:  0.5s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: C99 ERL JSRHINO PERL6 
Resource:  Own problem, used in ACM/ICPC Regional Contest, Shanghai 2011 preliminary 