AtCoder Regular Contest 155
C
Even Sum Triplet
AtCoder
⌀ 2219
原题
← BD →
翻译中…

Problem Statement

翻译中…

You are given integer sequences of length $N$: $A=(A_1, A_2, \dots, A_N)$ and $B=(B_1, B_2, \dots, B_N)$.

翻译中…

You may perform the following operation any number of times:

翻译中…
  • Choose an integer $i\ (1 \leq i \leq N-2)$ such that $A_i+A_{i+1}+A_{i+2}$ is even. Then, rearrange $A_i$, $A_{i+1}$, $A_{i+2}$ as you like.
翻译中…

Determine whether it is possible to make $A$ equal $B$.

翻译中…

Constraints

翻译中…
  • $3 \leq N \leq 2 \times 10^5$
  • $1 \leq A_i, B_i \leq 2 \times 10^5$
  • All values in the input are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N
A_1 A_2 \dots A_N
B_1 B_2 \dots B_N

翻译中…

Output

翻译中…

If it is possible to make $A$ equal $B$, print Yes; otherwise, print No.

翻译中…

样例

Input #1
5
1 2 3 4 5
3 1 2 4 5
Output #1
Yes
$A_1+A_2+A_3$ is $1+2+3=6$, which is even, so you can choose $i=1$. If you choose $i=1$ and rearrange $A_1, A_2, A_3$ into $A_3, A_1, A_2$, then $A$ becomes $(3, 1, 2, 4, 5)$. Now $A$ equals $B$, so you should print `Yes`.
Input #2
5
1 2 4 6 5
5 1 4 2 6
Output #2
No
Input #3
9
2 10 4 3 6 2 6 8 5
2 4 10 3 8 6 6 2 5
Output #3
Yes
题目信息
题号
arc155_c
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。