結果
問題 |
No.153 石の山
|
ユーザー |
|
提出日時 | 2025-07-23 13:04:33 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 5,000 ms |
コード長 | 559 bytes |
コンパイル時間 | 1,840 ms |
コンパイル使用メモリ | 195,768 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-07-23 13:04:37 |
合計ジャッジ時間 | 3,144 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 27 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; vector<int> G(N+2); G.at(1) = 0,G.at(2) = 1; for(int i=3; i<=N; i++){ int S = 0; if(i%2) S |= 1<<(G.at(i/2)^G.at(i/2+1)); else S |= 1; if(i%3 == 0) S |= 1<<G.at(i/3); else if(i%3 == 1) S |= 1<<G.at(i/3+1); else S |= 1<<G.at(i/3); for(int k=0; ; k++) if(!(S&(1<<k))){G.at(i) = k; break;} } if(G.at(N)) cout << "A\n"; else cout << "B\n"; }