結果
| 問題 |
No.153 石の山
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-01 18:44:29 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 5,000 ms |
| コード長 | 528 bytes |
| コンパイル時間 | 2,601 ms |
| コンパイル使用メモリ | 198,200 KB |
| 最終ジャッジ日時 | 2025-01-19 08:57:43 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 27 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
vector<int> g(n+1);
for (int i = 1; i <= n; i++) {
set<int> mex;
if (i >= 2)
mex.insert(g[i/2] ^ g[i-i/2]);
if (i >= 3)
mex.insert(g[i/3] ^ g[i/3+(i%3>0)] ^ g[i/3+(i%3>1)]);
for (int j = 0; ; j++) {
if (!mex.count(j)) {
g[i] = j;
break;
}
}
}
if (g[n])
cout << "A" << endl;
else
cout << "B" << endl;
return 0;
}