Alice and Bob have recently received a wonderful gift: a sorted array of positive integers! They have decided to create a new game using the array.
Starting with Alice, they take turns picking a positive element of the array and decreasing it by an arbitrary, non-zero amount. If a player cannot make a move on their turn, they lose. To make the game harder, they have also added the restriction that at the end of each player's turn, the array must still be sorted in non-decreasing order.
Alice and Bob have been playing this game for hours, but they are not sure if the moves that they are making are optimal. Hence, they have asked you to analyze their games and see who should have won if both players played optimally.
Input Specification
The input contains 10 datasets. Each dataset begins with an integer
For the first
For the first
Output Specification
For each dataset, output a string of length A
if Alice should have won that game or B
if Bob should have won that game.
Sample Input (Two Datasets Shown)
1
1
2
2
3
1 1 1
2
2 2
Sample Output
A
AB
Explanation of Sample Datasets
In the first dataset, Alice can win the game by decreasing the single array value to zero. In the second dataset, the only valid move in each turn of the first game is to decrease the left-most
Educational Computing Organization of Ontario - statements, test data and other materials can be found at ecoocs.org
Comments