Logo
(追記) (追記ここまで)

22267번 - Dividing Candy 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB28312811047.619%

문제

Bob and Charlie are two brothers that like powers of 2 a lot. Their mum decided to give them N boxes of candy, each of them containing a number of candy bars that is a power of 2.

They want to split the boxes between them, that is, for each box, they will decide who gets it. Each box must be given to exactly one brother.

Now they wonder: is it possible that, for each of the two brothers, the total amount of candy bars he receives is also a power of 2?

For example, if N = 4 and the boxes contain 4, 4, 32, and 8 candy bars, the answer would be yes, as one possible solution is giving the third box to Bob (32 candy bars), and the remaining boxes to Charlie (4 + 4 + 8 = 16 candy bars in total).

입력

The first line contains an integer N (1 ≤ N ≤ 105), the number of boxes the brothers want to split. The second line contains N integers A1, A2, . . . , AN (0 ≤ Ai ≤ 105 for i = 1, 2, . . . , N), indicating that the i-th box has 2Ai candy bars.

출력

Output a single line with the uppercase letter “Y” if it is possible to split the boxes so that the total amount of candy received by each brother is a power of 2, and the uppercase letter “N” otherwise.

제한

예제 입력 1

4
2 2 5 3

예제 출력 1

Y

예제 입력 2

1
42

예제 출력 2

N

예제 입력 3

5
3 1 4 1 5

예제 출력 3

N

예제 입력 4

7
0 0 1 2 3 4 5

예제 출력 4

Y

힌트

출처

ICPC > Regionals > Latin America > Latin America Regional Contests > Latin America Regional Contests 2020 D번

  • 문제를 만든 사람: Arthur Nascimento
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /