#P6760. [THUPC 2019] 大碗宽面
[THUPC 2019] 大碗宽面
Description
Yazid likes to eat big bowl wide noodles. Now there are bowls of wide noodles. In the -th bowl of wide noodles (), there are noodles in total, and their widths are .
Let denote the width of the -th smallest noodle after mixing the -th bowl of wide noodles and the -th bowl of wide noodles to get an extra-large bowl of wide noodles ( denotes the greatest integer not exceeding ).
Yazid wants to find all , but to save your output time, you only need to compute for all :
- $R(u)=\mathop{\rm xor}\limits_{v=1}^{m} {(f(u,v)+u+v)}$ ( means the bitwise XOR operation, which corresponds to the
^operator in C++).
Input Format
The first line contains a positive integer , representing the number of bowls of wide noodles.
The next lines describe one bowl of wide noodles per line using several integers separated by single spaces: on the -th line, the first positive integer is , meaning the number of noodles in the -th bowl; then non-negative integers describe the widths of the noodles.
Output Format
Output lines, each containing one integer. The integer on the -th line should be .
3
3 1 2 3
3 3 4 5
2 4 2
4
7
7
Hint
Sample Explanation
For sample :
- $\def\x{\operatorname{xor}} R(1) = {(f(1,1)+2)}\x{(f(1,2)+3)}\x{(f(1,3)+4)} = 4\x6\x6 = 4$
- $\def\x{\operatorname{xor}} R(2) = {(f(2,1)+3)}\x{(f(2,2)+4)}\x{(f(2,3)+5)} = 6\x8\x9 = 7$
- $\def\x{\operatorname{xor}} R(3) = {(f(3,1)+4)}\x{(f(3,2)+5)}\x{(f(3,3)+6)} = 6\x9\x8 = 7$
Constraints
For of the testdata, , , .
Notes
From THUPC (THU Programming Contest, Tsinghua University Programming Contest) 2019.
Solutions and other resources can be found at https://github.com/wangyurzee7/THUPC2019.
Translated by ChatGPT 5
京公网安备 11011102002149号