No.2059 Odd Move Nim
レベル :
/ AI推定難易度 : 1425
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 105
作問者 :
nok0
/ テスター :
hir355
ぷら
ygussany
taiga0629kyopro
タグ : / 解いたユーザー数 105
作問者 :
nok0
/ テスター :
hir355
ぷら
taiga0629kyopro
問題文最終更新日: 2022-08-21 19:11:03
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder contest 358
(順位表)
の他の問題:
Problem Statement
There are piles of stones numbered from $1$ to $N$. Initially, pile $i$ contains $A_i$ stones.
Alice and Bob play a game using these piles. Starting with Alice, they alternately perform the following operation, and the player who cannot perform the operation loses.
- Choose an integer $i$ between $2$ and $N$, inclusive, and an odd number $x$ that is at least $1$ and less than $i$. Choose $1$ or more stones from pile $i$ and move them to pile ${i-x}$.
Determine which player wins the game when both players act optimally.
Constraints
- All input values are integers.
- $2 \le N \le 200000$
- $A_1 = 0$
- $0 \le A_i< 2 ^ {30}\ (2\le i \le N)$
Input
$N$ $A_1$ $A_2$ $\ldots$ $A_N$
Output
Print Alice if Alice wins, and Bob if Bob wins.
Sample
Sample 1
Input
3 0 1 2
Output
Alice
By first moving $1$ stone from pile $2$ to pile $1$, Alice can always win.
Sample 2
Input
4 0 1 0 1
Output
Bob
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。