No.1717 Levi-Civita Triangle
問題文最終更新日: 2021-10-10 01:02:59
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder contest 319
(順位表)
の他の問題:
Problem Statement
You are given a sequence $(A_1, A_2, \ldots, A_{2N+1})$ of length $2N + 1$ consisting of $0$, $1$, $2$. Apply the following operation to this sequence $N$ times.
- Replace the original sequence with a new sequence whose length is shorter by $2$. Let $P_i$ and $Q_i$ be the $i$-th elements of the old sequence and the new sequence, respectively. Then, $Q_i$ is determined by the following rule.
Constraints
- All inputs are integers.
- $1 \le N \le 10^5$
- $0 \le A_i \le 2$ $(1 \le i \le 2N + 1)$
Input
The input is given from standard input in the following format.$N$
$A_1$ $A_2$ $\cdots$ $A_{2N+1}$
Output
The final sequence consists of $1$ element. Print that element.
Sample
Sample 1
Input
1 0 1 2
Output
1
Sample 2
Input
2 1 2 0 2 1
Output
2
Sample 3
Input
3 0 1 2 2 0 1 0
Output
0
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
nok0
Kite_kuma