#P7467. [CERC2018] Game of Stones

[CERC2018] Game of Stones

Description

Translated from [CERC2018] Game of Stones.

Petyr and Varys are playing a game. In the game, the players take turns removing some stones from NN piles. On his turn, Petyr may remove at most AA stones from any one pile, and Varys may remove at most BB stones from any one pile. In each turn, a player must remove at least one stone. The player who takes the last stone wins.

The game has already started, and now it is Petyr's turn to take stones. Your task is to determine whether Petyr can win if both players use optimal strategies.

Input Format

The first line of input contains three integers N,A,BN, A, B, meaning there are NN piles of stones and the two players' limits.

The second line contains NN numbers X1,X2,,XNX_1, X_2, …, X_N, representing the current number of stones in each pile.

Output Format

Output the winner's name.

2 3 4
2 3
Petyr
7 8 9
1 2 3 4 5 6 7
Varys

Hint

Constraints: 1N,A,B1051 \le N, A, B \le 10^5, 1Xi1061 \le X_i \le 10^6.

Translated by ChatGPT 5