結果
問題 | No.2059 Odd Move Nim |
ユーザー |
![]() |
提出日時 | 2025-03-29 07:04:21 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 24 ms / 2,000 ms |
コード長 | 776 bytes |
コンパイル時間 | 3,162 ms |
コンパイル使用メモリ | 274,132 KB |
実行使用メモリ | 7,328 KB |
最終ジャッジ日時 | 2025-03-29 07:04:27 |
合計ジャッジ時間 | 4,772 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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);/*i番目の山の1つの石のgrundy数を考える。0のgrundy数が1で奇数番目からは偶数番目にしか遷移できないのでgrundy数(mex)は1偶数番目からは奇数番目にしか遷移できないのでgrundy数(mex)は0よって奇数番目の山だけのgrundy数を見れば良い。*/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;}