No.387 Stamp
Problem Statement
MKM has a grid-shaped stamp of length $N$. Each cell of the stamp has paint on it. The color of the paint on the $i$-th cell is $a_i$.
MKM also has a grid-shaped sheet of paper of length $2 \times N-1$. Initially, none of its cells has any paint on it.
MKM presses the stamp on the paper several times. This information is given as a sequence $b_i$ of length $N$. Each $b_i$ is $0$ or $1$, and $1$ means that he pressed the stamp so that its left end overlapped the $i$-th cell from the left of the paper. He never presses the stamp at the same position $2$ times.
For each cell, MKM wants to count how many colors of paint are mixed in it. However, this turned out to be difficult, so for now he decided to determine only whether the answer is even or odd.
Note that the paper is dried after every press of the stamp, so you do not need to consider paint on the paper transferring to the stamp.
Input
$N$ $a_1$ $a_2$ $\dots$ $a_N$ $b_1$ $b_2$ $\dots$ $b_N$
All inputs are integers.
$1 \le N \le 100,000$
$1 \le a_i \le 100,000$
$b_i$ is $0$ or $1$
Output
Output $2 \times N-1$ lines.
On the $i$-th line, print "EVEN" if the answer for the $i$-th cell is even, and "ODD" if it is odd.
Sample
Sample 1
Input
3 1 2 3 1 0 1
Output
ODD ODD EVEN ODD ODD
$b_1$ and $b_3$ are $1$. Supposing the former is pressed first, the first press of the stamp looks like the figure below.
The second press of the stamp then looks like the figure below.
The result looks like the figure below.
Therefore, the paints on the 1st, 2nd, 3rd, 4th, and 5th cells are {1}, {2}, {1, 3}, {2}, {3}, so only the 3rd cell is even.
Sample 2
Input
3 1 2 1 1 0 1
Output
ODD ODD ODD ODD ODD
The paints on the 1st, 2nd, 3rd, 4th, and 5th cells are {1}, {2}, {1}, {2}, {1}, so all of them are odd.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
yosupot
anta