시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
0.5 초 | 512 MB | 44 | 14 | 11 | 27.500% |
Samouel has an array A of N integers indexed from 1 to N. Initially, all of the integers are 0. His friend, Gregor also has an array B of N integers indexed from 1 to N.
Samouel wants to modify his array such that his array becomes equal to Gregor's. To achieve that, Samouel can apply the following operation: choose two consecutive indices i and i + 1 (1 ≤ i < N) and do either the following:
Determine whether it is possible for Samouel to achieve his goal.
The first line contains one integer: N (1 ≤ N ≤ 100) in a line denoting the length of both array A and B. The second line contains N integers: B1, B2, ..., BN (0 ≤ Bi ≤ 50,000) in a line denoting the value of array B.
Output “YES" in a line if it is possible for Samouel to achieve his goal, or "NO" otherwise.
6 1 3 2 0 4 2
YES
3 2 8 2
YES
3 2 2 8
NO
5 0 0 0 0 3
NO
5 0 0 0 0 1
NO
ICPC > Regionals > Asia Pacific > Indonesia > Indonesia National Contest > INC 2017 K번