QOJ.ac

QOJ

Time Limit: 5 s Memory Limit: 512 MB Total points: 100

#11279. M47升级型“钢铁阿诺”

统计

给定一个长度 $n$ 的整数序列 $a_1,\dots,a_n$ ;

给定一个由 $m$ 次操作构成的操作序列,操作从 $1$ 开始编号,到 $m$ 结束。操作序列中包含修改操作和求和操作,修改操作给定 $l,r,v$ ,将 $a_l,a_{l+1},\dots,a_r$ 修改为 $v$ ,求和操作给定 $l,r$ ,查询 $\sum\limits_{i=l}^r a_i$;

共 $q$ 次查询,每次查询给出 $L,R$ ,询问将序列 $a$ 初始化为 $0$ 后,依次进行操作序列中的第 $L,L+1,\dots,R$ 次操作,每次求和操作的答案之和。

输入格式

第一行三个整数 $n,m,q$ ;

接下来 $m$ 行,每行 $1,l,r,v$ 或 $2,l,r$ 表示一次操作;

接下来 $q$ 行,每行两个整数 $L,R$ 表示一次查询。

输出格式

共 $q$ 行,每行一个整数,依次表示每次查询的答案。

样例数据

样例输入

10 5 4
1 9 10 7
1 7 10 9
2 3 10
1 10 10 1
2 5 10
2 5
1 1
3 4
1 3

样例输出

64
0
0
36

子任务

Idea:Ynoi,Solution:nzhtl1477&ccz181078,Code:ccz181078,Data:ccz181078

对所有数据,满足 $1\le l\le r\le n$,$1\le v\le n$,$1\le L\le R\le m$,$1\le n,m,q\le 5\times 10^5$。

对 $10\%$ 的数据,$n,m,q\le 10^2$。

对另外 $20\%$ 的数据,$n,m,q\le 5\times 10^3$。

对另外 $10\%$ 的数据,每次操作都是求和操作。

对另外 $20\%$ 的数据,每次查询满足 $L=1$。

对另外 $20\%$ 的数据,$n,m,q\le 2\times 10^5$。

对于其余数据,无特殊限制。

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.