#arc138b. [arc138_b]01 Generation
[arc138_b]01 Generation
Problem Statement
Snuke is about to make an integer sequence of length consisting of and . He starts with an empty sequence and does the following two kinds of operations times in total, in any order he likes.
- Operation A: Flip every element of , that is, convert each to and vice versa. Then, add to the beginning of .
- Operation B: Add to the end of .
You are given an integer sequence of length consisting of and : . Determine whether it is possible to make equal to .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
If it is possible to make equal to , print Yes
; otherwise, print No
.
Sample Input 1
4
0 1 1 0
Sample Output 1
Yes
Snuke can do the following.
- Start with
- Do operation A, making .
- Do operation B, making .
- Do operation A, making .
- Do operation B, making .
Sample Input 2
4
1 0 0 0
Sample Output 2
No
Sample Input 3
4
0 0 0 1
Sample Output 3
No