#P4054. [JSOI2009] 计数问题
[JSOI2009] 计数问题
Description
There is an grid. Initially, each cell has an integer weight. Then there are 2 types of operations:
- Change the weight of a cell.
- Query how many times a specified weight appears in a submatrix.
Input Format
The first line contains two integers .
Then follow lines, each with integers. In the -th line, the -th number is the initial weight of cell .
Then an integer is given.
Then there are lines, each describing an operation.
Operation 1: A line with four integers , meaning set the weight of cell to .
Operation 2: A line with six integers , meaning query the number of cells whose weight is and satisfy .
Output Format
For each operation 2, output one integer per line in the order they appear, representing the required count.
3 3
1 2 3
3 2 1
2 1 3
3
2 1 2 1 2 1
1 2 3 2
2 2 3 2 3 2
1
2
Hint
Constraints
For of the testdata: , .
For of the testdata: , .
For operation 1, it is guaranteed that , , .
For operation 2, it is guaranteed that , , .
Translated by ChatGPT 5
京公网安备 11011102002149号