| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 0.5 초 (추가 시간 없음) | 1024 MB | 142 | 83 | 74 | 66.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.
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.
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
N
2 1 2 4 8 16 32
Y
Carlinhos wins no matter how he plays, since all subsets have distinct sums.
1 2 3 3
Y
Carlinhos can win by picking the number 2. Notice that he would have lost if he picked a 3.