#P6532. [COCI 2015/2016 #1] TOPOVI
[COCI 2015/2016 #1] TOPOVI
Description
There is an chessboard with pieces on it. Each piece has a power value .
We define the following rules:
- The attack range of a piece is the row and the column it is in, excluding its own cell.
- A cell on the board is considered attacked if and only if the XOR sum of the power values of all pieces that can attack it is greater than .
Now we will perform operations. After each operation, output the total number of cells that are attacked.
Input Format
The first line contains three integers .
The next lines each contain three integers . The -th line means there is a piece at position with power value .
The next lines each contain four integers , meaning the piece at is moved to .
Output Format
Output lines. Each line contains one integer. The -th line is the total number of cells that are attacked after the -th operation.
2 2 2
1 1 1
2 2 1
2 2 2 1
1 1 1 2
4
0
2 2 2
1 1 1
2 2 2
2 2 2 1
1 1 1 2
4
2
3 3 4
1 1 1
2 2 2
2 3 3
2 3 3 3
3 3 3 1
1 1 1 2
3 1 3 2
6
7
7
9
Hint
Constraints
- For of the testdata, .
- For of the testdata, , , , , . During movements, pieces will not overlap.
Notes
This problem is worth 120 points.
This problem is translated from T4 TOPOVI, Croatian Open Competition in Informatics 2015/2016 Contest #1.
Translated by ChatGPT 5
京公网安备 11011102002149号