結果
| 問題 |
No.153 石の山
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-08-31 16:24:55 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 414 bytes |
| コンパイル時間 | 1,600 ms |
| コンパイル使用メモリ | 174,424 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-08-31 16:24:58 |
| 合計ジャッジ時間 | 2,560 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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> dp(n+1, 0);
for (int i = 2; i <= n; i++) {
set<int> st;
st.insert(dp[i/3]^dp[(i+1)/3]^dp[(i+2)/3]);
st.insert(dp[i/2]^dp[(i+1)/2]);
while (st.count(dp[i])) dp[i]++;
}
cout << (dp[n] == 0 ? "B": "A") << "\n";
}