Score | |
---|---|
Problem A | 460 |
Problem B | 690 |
Problem C | 1150 |
Problem D | 1380 |
Problem E | 1840 |
Problem F1 | 1380 |
Problem F2 | 920 |
Successful hack | 100 |
Unsuccessful hack | -50 |
Unsuccessful submission | -50 |
Resubmission | -50 |
Note: The XOR-sum of set
After almost winning IOI, Victor bought himself an
Sadly, Mihai stole the grid from Victor and told him he would return it with only one condition: Victor has to tell Mihai the XOR-sum of all the integers in the whole grid.
Victor doesn't remember all the elements of the grid, but he remembers some information about it: For each cell, Victor remembers the XOR-sum of all its neighboring cells.
Two cells are considered neighbors if they share an edge — in other words, for some integers
To get his grid back, Victor is asking you for your help. Can you use the information Victor remembers to find the XOR-sum of the whole grid?
It can be proven that the answer is unique.
The first line of the input contains a single integer
The first line of each test case contains a single even integer
Then follows
It is guaranteed that the sum of
Hack Format
To hack a solution, use the following format:
The first line should contain a single integer t (
The first line of each test case should contain a single even integer
Then
The sum of
For each test case, output a single integer — the XOR-sum of the whole grid.
3 2 1 5 5 1 4 1 14 8 9 3 1 5 9 4 13 11 1 1 15 4 11 4 2 4 1 6 3 7 3 10 15 9 4 2 12 7 15 1
4 9 5
For the first test case, one possibility for Victor's original grid is:
For the second test case, one possibility for Victor's original grid is:
For the third test case, one possibility for Victor's original grid is:
Name | |||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
No items |