Solve this problem in C++. Comments your code. Explain the solution before implementing…
- User
Solve this problem in C++. Comments your code. Explain the solution before implementing and make sure to explain detailedly: Today Axel is in a hot and dusty desert wearing weird cosplay with some tubes in his nose. Due to some misunderstandings in the past, blue-eyed people started calling him Lisan al Gaib, and he doesn't want to be part of their water fanatics group. These people decided to put Axel through a tough test that he can pass only if he is the savior they believe him to be.
The test is a game consisting of n piles of stones laid out in a row, with positions numbered 1 through n from left to right, the i-th of them having ai stones. Two players (Axel and his tester) alternate turns. Axel will have the first turn.
Each turn, the current player has two possible moves:
- Choose a non-empty pile i (2≤i≤n) and move c (0<c≤ai) stones from this pile to the top of pile i−1.
- Choose two non-empty piles i,j (2≤i<j≤n). Combine the stones from piles i and i−1 into one pile. This eliminates pile i from the row. Then, take zero or more stones (you can take them all) from pile j and place them directly to the right, creating a new pile between piles j and j+1 (in case that pile j+1 exists). After the move, all piles are renumbered from left to right to restore the usual range (1 to n).
The player with no possible moves is the winner. Sadly, Axel promised himself that he will never lose a game he can win, and of course, his tester won't make it easy for him. So you can assume both players will play optimally. As a bene gesserit descendant and the real Lisan al Gaib, you want to know beforehand who will win.
Note that after each turn, the sum of the stones in the piles remains the same, and the number of piles doesn't change either. It can be proven that this game must end. Input The first line contains one integer n (1≤n≤2⋅10^5) indicating the number of piles.
The second line contains n integers; the i-th of them is ai (0≤ai≤10^9), the number of stones of the i-th pile.
Output
If Axel will be the winner, print "Lisan al Gaib" without quotes; otherwise, print "It's just Axel" without quotes. Please don't output extra spaces at the end of the line or your answer may be considered incorrect.
- Assistant