Blackboard Game

시간 제한0.5초메모리 제한1024 MB

요약
첫 번째 플레이어가 매 라운드 수 하나를 표시하고 상대가 남은 수 중 하나를 남기고 하나를 지우는 게임에서 합이 달라지도록 강제할 수 있는지 판정한다.
난이도

보통10점 중 7점

유형
정렬, 그리디, 게임 이론
정답자
아직 제출이 없습니다

문제

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.

예제3

  1. 예제 1

    입력
    5
    5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
    
    예상 출력
    N
    
  2. 예제 2

    입력
    2
    1 2 4 8 16 32
    
    예상 출력
    Y
    
  3. 예제 3

    입력
    1
    2 3 3
    
    예상 출력
    Y