No.814 Jiji Nuki
Problem Statement
Iruka-chan is about to play Jiji Nuki in order to post a video.
Since Iruka-chan can tell the numbers written on the cards by echolocation, she wants to compute the number that will be the "Jiji" before the game starts.
Iruka-chan is about to start a game of Jiji Nuki with $N$ players.
The hands have already been dealt, and all paired cards in the hands have been discarded.
Player $i$ holds $K_i$ cards, and the integers written on them are $\{L_i, L_i+2^{D_i}, L_i+2\times 2^{D_i}, \cdots, L_i+(K_i-1)\times 2^{D_i}\}$.
There exists an integer $x$ such that "the number of players holding a card with $x$ written on it is odd, and for every integer $y$ other than $x$, the number of players holding a card with $y$ written on it is even".
Find $x$.
Note (you do not need to read this):
In the Jiji Nuki of this problem, unlike with real playing cards, the numbers written on the cards are between $0$ and $10^{18}$, inclusive, and there are $10^{100}$ cards of each kind.
Exactly 1 card with $x$ written on it is removed, and then all the remaining cards are dealt to the $N$ players. The number of cards dealt to each player does not need to be equal.
After the hands are dealt, each player repeats the operation "find a pair of cards in the hand with the same number written on them and discard both cards of that pair" until the operation can no longer be performed.
Input
$N$ $K_1$ $L_1$ $D_1$ $\dots$ $K_N$ $L_N$ $D_N$
$1$ $\le$ $N$ $\le$ $3 \times 10^5$
$K_i$ $\ge$ $1$
$0$ $\le$ $D_i$ $\le$ $59$
$0$ $\le$ $L_i$ $\le$ $L_i+(K_i-1)*2^{D_i}$ $\le$ $10^{18}$
All values are integers.
$N$ is given on line 1,
and the following $N$ lines give the information on the hand of player $i$.
The $x$ described in the problem statement exists and is unique.
Output
Output the answer on 1 line. Print a newline at the end.
Sample
Sample 1
Input
1 1 1 50
Output
1
There may be only one player. The player holds the cards $\{1\}$.
Sample 2
Input
2 5 1 0 6 0 0
Output
0
Person 1 holds the cards $\{1, 2, 3, 4, 5\}$,
and person 2 holds the cards $\{0, 1, 2, 3, 4, 5\}$.
Sample 3
Input
3 6 1 0 3 1 1 2 2 2
Output
4
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
Lepton_s
37zigen