SP2713 GSS4 - Can you answer these queries IV

    • 471通过
    • 1.6K提交
  • 题目来源 SPOJ 2713
  • 评测方式 RemoteJudge
  • 标签 线段树
  • 难度 省选/NOI-
  • 时空限制 500ms / 1536MB

题解

  • 提示:收藏到任务计划后,可在首页查看。
  • 最新讨论 显示

    推荐的相关题目 显示

    题意翻译

    「题意」: $n$ 个数,和在$10^{18}$ 范围内。

    也就是$\sum~a_i~\leq~10^{18}$

    现在有「两种」操作

    0 x y把区间$[x,y]$ 内的每个数开方,下取整

    1 x y询问区间$[x,y]$ 的每个数的和

    「格式」: 有多组数据,数据以EOF结束,对于每组数据,输出数据的序号,每组数据之后输出一个空行。

    「注意」: 不保证给出的区间$[x, y]$ 有$x <= y$ ,如果$x>y$ 请交换$x$ ,$y$ 。

    感谢@Edgration 提供的翻译

    题目描述

    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 x-th and the y-th 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 x-th and the y-th ones (inclusively, counting from 1) in the sequence.

    输入输出格式

    输入格式:

    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.

    输出格式:

    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.

    输入输出样例

    输入样例#1: 复制
    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
    输出样例#1: 复制
    Case #1:
    9
    4
    6
    
    Case #2:
    40
    26
    提示
    标程仅供做题后或实在无思路时参考。
    请自觉、自律地使用该功能并请对自己的学习负责。
    如果发现恶意抄袭标程,将按照I类违反进行处理。