#ABC476F. 切比雪夫咖啡馆 / Chebyshev Cafe
切比雪夫咖啡馆 / Chebyshev Cafe
Problem Statement
There is a city represented by a grid with rows and columns. The cell at the -th row from the top and -th column from the left is denoted as cell . Each cell has one cafe.
You are planning a meeting. Among the participants, the number of people living in cell is . The travel cost for one participant living in cell to go to the cafe at cell is .
Let be the total travel cost incurred when gathering all the participants at the cafe at cell .
For each cell , find the following value, and output the bitwise XOR of these values over all cells.
What is the bitwise XOR operation?
The bitwise XOR of non-negative integers and (denoted ) is defined as follows.
- The digit in the 's place () of written in binary is if exactly one of the digits in the 's place of and written in binary is , and otherwise.
For example, (in binary: ). More generally, the bitwise XOR of non-negative integers is defined as $(\dots ((p_1 \oplus p_2) \oplus p_3) \oplus \dots \oplus p_k)$, and it can be proved that this does not depend on the order of .
Constraints
- ()
- ()
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Output the answer.
4 19
2 3 1 1
3 4 4 10
467
The number of participants living in each cell is as follows: $\displaystyle \begin{bmatrix} 6 & 8 & 8 & 1 \\ 9 & 12 & 12 & 11 \\ 3 & 4 & 4 & 10 \\ 3 & 4 & 4 & 10 \end{bmatrix}$.
For example, the value of is obtained as the sum of the following values:
- The total amount paid by the residents of cell , each of whom pays a travel cost of
- The total amount paid by the residents of cell , each of whom pays a travel cost of
- The total amount paid by the residents of cell , each of whom pays a travel cost of
- The total amount paid by the resident of cell , each of whom pays a travel cost of
- The total amount paid by the residents of cell , each of whom pays a travel cost of
- The total amount paid by the residents of cell , each of whom pays a travel cost of
- The total amount paid by the residents of cell , each of whom pays a travel cost of
- The total amount paid by the residents of cell , each of whom pays a travel cost of
The value of for each cell is as follows: $\displaystyle \begin{bmatrix} 220 & 176 & 179 & 224 \\ 199 & 140 & 136 & 182 \\ 212 & 159 & 143 & 178 \\ 255 & 215 & 201 & 218 \end{bmatrix}$.
6 67
1 6 9 2 3 1
1 10 3 7 2 2
1021
20 676767
60932 508200 22883 481150 426836 554098 276223 307959 133025 573906 17711 413230 274246 500277 524959 477728 546547 43099 324227 660187
552697 293978 246000 159233 213736 628198 394200 194076 618720 453035 615100 331522 669419 180856 530693 399531 223149 159334 102107 598633
764668547
- Source: AtCoder ABC 476 F
相关
在下列比赛中: