QOJ.ac

QOJ

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

#14176. TEST_152

Statistics

转转有一个操作序列 $(l_i,r_i,v_i)$。

现在,有 $q$ 个询问 $l$,$r$。

每次询问,你初始有一个长度为 $m$ 的序列 $c$,初值全是 $0$。

现在我们从 $l$ 到 $r$ 执行这 $r-l+1$ 个操作。

每个操作是将 $c[l_i]$~$c[r_i]$ 赋值为 $v_i$。

询问所有操作结束后整个 $c$ 的序列所有数的和。

询问之间互相独立。

输入格式

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

第 $2$~$n+1$ 行,每行 $3$ 个正整数,第 $i+1$ 行表示 $l_i$,$r_i$,$v_i$。

后面 $q$ 行,每行两个正整数,表示一次询问 $l$,$r$。

输出格式

$q$ 行,每行一个正整数,表示询问的答案。

样例数据

样例 1 输入

4 5 3
1 4 3
2 3 1
5 5 2
1 2 4
1 2
1 4
2 3

样例 1 输出

8
14
4

样例 2 输入

10 10 10
1 5 20
5 7 7
3 6 8
1 6 20
1 7 14
5 6 5
9 9 18
5 10 5
1 9 6
1 5 19
1 10
5 5
7 10
4 8
1 9
1 6
6 7
7 10
2 6
1 4

样例 2 输出

124
98
124
86
59
80
28
124
80
127

子任务

Idea:Ynoi,Solution:Ynoi,Code:Ynoi,Data:Ynoi

对于 $100\%$ 的数据,满足

$ 1 \le n,m,q \le 5 \times 10^5$

$ 1 \le l_i \le r_i \le m$

$0 \le v_i \le 2 \times 10^9$

$1 \le x_i \le y_i \le n$。

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.