#P8512. [Ynoi Easy Round 2021] TEST_152
[Ynoi Easy Round 2021] TEST_152
Problem Description
Zhuanzhuan has an operation sequence of length , .
Now there are queries .
For each query, you initially have a sequence of length , with all initial values equal to .
Now we execute, in order, the operations corresponding to items of the operation sequence.
Each operation sets through to .
For each query, output the sum of all numbers in the entire sequence after all operations finish.
Queries are independent of each other.
Input Format
The first line contains three positive integers .
Lines to each contain three positive integers. Line gives .
The next lines each contain two positive integers, describing one query .
Output Format
Output lines, each containing one positive integer, the answer to the query.
4 5 3
1 4 3
2 3 1
5 5 2
1 2 4
1 2
1 4
2 3
8
14
4
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
124
98
124
86
59
80
28
124
80
127
Hint
Idea: Ynoi, Solution: Ynoi, Code: Ynoi, Data: Ynoi
For of the testdata, it holds that:
.
.
.
.
Translated by ChatGPT 5