P7467 [CERC2018] Game of Stones

Description

**Translated from [ [CERC2018]](https://contest.felk.cvut.cz/18cerc/) [Game of Stones](https://contest.felk.cvut.cz/18cerc/solved/stones.pdf).** Petyr and Varys are playing a game. In the game, the players take turns removing some stones from $N$ piles. On his turn, Petyr may remove at most $A$ stones from any one pile, and Varys may remove at most $B$ 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, B$, meaning there are $N$ piles of stones and the two players' limits. The second line contains $N$ numbers $X_1, X_2, …, X_N$, representing the current number of stones in each pile.

Output Format

Output the winner's name.

Explanation/Hint

Constraints: $1 \le N, A, B \le 10^5$, $1 \le X_i \le 10^6$. Translated by ChatGPT 5