結果
問題 | No.2059 Odd Move Nim |
ユーザー |
![]() |
提出日時 | 2025-03-29 07:19:28 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 24 ms / 2,000 ms |
コード長 | 833 bytes |
コンパイル時間 | 3,533 ms |
コンパイル使用メモリ | 273,732 KB |
実行使用メモリ | 7,324 KB |
最終ジャッジ日時 | 2025-03-29 07:19:34 |
合計ジャッジ時間 | 5,459 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h>//#include <atcoder/modint>using namespace std;//using namespace atcoder;using ll = long long;//using mint = modint998244353;int main(){cin.tie(nullptr);ios_base::sync_with_stdio(false);/*複数の石を選べることに注意する。0-indexedでx = A_1 xor A_3 xor ...がgrundy数操作できない盤面でx=0x = 0の盤面からは偶数番目の石を1個以上奇数番目に移すのでx=0に遷移できず、逆にx != 0の盤面からは常にx = 0に遷移できる。(Nimと同じく奇数番目の山だけで捨てる。)*/ll N, A, g=0;cin >> N;for (int i=0; i<N; i++){cin >> A;if (i % 2 == 1) g ^= A;}cout << (g == 0 ? "Bob" : "Alice") << endl;return 0;}