Game of Stones

시간 제한2초메모리 제한512 MB

요약
두 사람이 번갈아 한 더미에서 1개 이상 A개 이하(Petyr) 또는 B개 이하(Varys)의 돌을 가져갈 때, 먼저 두는 Petyr이 이길 수 있는지 판정한다.
난이도

보통10점 중 7점

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

문제

Two players, Petyr and Varys, play a game in which players remove stones from N piles in alternating turns. Petyr, in his turn, can remove at most A stones from any pile. Varys, in his turn, can remove at most B stones from any pile. Each player has to remove at least one stone in his turn. The player who removes the last stone wins.

The game has already started and it is Petyr’s turn now. Your task is to determine whether he can win the game if both he and Varys play the game in the best possible way.

입력

The first input line contains three integers N, A, and B (1 ≤ N ≤ 105 and 1 ≤ A, B ≤ 105). N describes the number of piles and A, B represent Petyr’s and Varys’ restrictions. The second line contains N integers X1, . . . , XN (1 ≤ Xi ≤ 106) specifying the current number of stones in all piles.

출력

Output the name of the winner.

예제2

  1. 예제 1

    입력
    2 3 4
    2 3
    
    예상 출력
    Petyr
    
  2. 예제 2

    입력
    7 8 9
    1 2 3 4 5 6 7
    
    예상 출력
    Varys