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

30477번 - Blackboard Game 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
0.5 초 (추가 시간 없음) 1024 MB142837466.071%

문제

Carlinhos and Equalizer are playing a game. The game begins with 3N elements, which are integer numbers, written on a blackboard. Then, for N rounds, the following two steps are repeated.

  1. Carlinhos, the first player, selects an unchosen element and marks it with a red circle.
  2. Equalizer, the second player, picks two unchosen elements, marks one of them with a blue square, and erases the other from the blackboard.

At the end of these rounds, the blackboard contains N red-marked elements and N bluemarked elements, with no moves left. The game concludes with a clear winner: if the sum of the red-marked elements differs from the sum of the blue-marked elements, Carlinhos emerges victorious; otherwise, Equalizer takes the win.

The figure below depicts the only possible outcome for the first sample. In this case Equalizer wins for sure, no matter how they play both sums will be equal to 25.

Carlinhos, feeling the game is imbalanced, seeks to determine whether he can secure a victory when both players play optimally. Can you help him with this task?

입력

The first line contains an integer N (1 ≤ N ≤ 1000).

he second line contains 3N integers B1, B2, ..., B3N (-105 ≤ Bi ≤ 105 for i = 1, 2, . . . , 3N), representing the numbers initially written on the blackboard.

출력

Output a single line with the uppercase letter “Y” if Carlinhos can win the game and the uppercase letter “N” otherwise, assuming both players play optimally.

제한

예제 입력 1

5
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5

예제 출력 1

N

예제 입력 2

2
1 2 4 8 16 32

예제 출력 2

Y

Carlinhos wins no matter how he plays, since all subsets have distinct sums.

예제 입력 3

1
2 3 3

예제 출력 3

Y

Carlinhos can win by picking the number 2. Notice that he would have lost if he picked a 3.

힌트

출처

ICPC > Regionals > Latin America > Latin America Regional Contests > Latin America Regional Contests 2023 B번

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

출처

대학교 대회

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

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