結果
問題 | No.153 石の山 |
ユーザー |
|
提出日時 | 2024-08-31 15:39:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 736 bytes |
コンパイル時間 | 1,831 ms |
コンパイル使用メモリ | 170,736 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-08-31 15:39:09 |
合計ジャッジ時間 | 2,905 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 WA * 10 |
ソースコード
#include<bits/stdc++.h>using namespace std;int main() {ios_base::sync_with_stdio(false);cin.tie(nullptr);int n;cin >> n;vector<int> memo(n+1, -1);auto g = [&] (auto self, int i) -> int {if (memo[i] != -1) return memo[i];if (i == 0 || i == 1) return memo[i] = 0;set<int> st;int res = 0;if (i % 3 == 1) {res = self(self, i/3 + 1);} else {res = self(self, i/3);}if (res == 0) return memo[i] = 1;res = 0;if (i & 1) {res = i^(i-1);} else {res = 0;}return memo[i] = (res == 0? 1: 0);};cout << (g(g, n) == 0 ? "B": "A") << "\n";}