#P6109. [Ynoi2009] rprmq1
[Ynoi2009] rprmq1
Background
Uh...
This problem has an input size of about 13 MB and an output size of about 7 MB. Please choose an appropriate input/output method.
Problem Description
There is an matrix , initially all . There are update operations and query operations. All update operations are performed first, and then all query operations are performed.
An update operation gives , meaning to add a value to all elements satisfying and .
A query operation gives , meaning to query the maximum value among all elements satisfying and .
Input Format
The first line contains three integers separated by spaces.
The next lines each contain five integers , describing an update operation.
The next lines each contain four integers , describing a query operation.
Output Format
Output lines. For each query operation, output one number per line as the answer.
5 5 5
1 1 4 5 4
4 1 4 1 10
1 3 3 3 3
1 1 5 5 8
2 4 4 5 8
2 1 2 1
4 1 5 4
1 2 3 5
2 1 5 3
1 3 5 5
12
22
20
22
20
Hint
Idea: apiadu, Solution: ccz181078, Code: apiadu, Data: apiadu & nzhtl1477.
Note: This problem uses bundled subtasks. You can only get the score for a subtask after passing all test points in that subtask.
For of the testdata, it is Sample 1.
For another of the testdata, .
For another of the testdata, .
For another of the testdata, and .
For another of the testdata, .
Constraints: For of the testdata, , , , , .
Translated by ChatGPT 5