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$。

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

Discussions

About Discussions

The discussion section is only for posting: Editorials, General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues. Submitting multiple issues may cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.