結果
問題 |
No.153 石の山
|
ユーザー |
|
提出日時 | 2025-02-10 18:13:45 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 886 bytes |
コンパイル時間 | 3,112 ms |
コンパイル使用メモリ | 278,796 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-02-10 18:13:50 |
合計ジャッジ時間 | 4,351 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 27 |
ソースコード
#include <bits/stdc++.h> // #include <atcoder/all> // using mint = atcoder::static_modint<998244353>; // using mint = atcoder::static_modint<1000000007>; using namespace std; // using namespace atcoder; using ld = long double; using ll = long long; #define mp(a,b) make_pair(a,b) #define rep(i,s,n) for(int i=s; i<(int)n; i++) const vector<int> dx{1,0,-1,0},dy{0,1,0,-1}; vector<int>memo(101,-1); int solve(int x){ if(memo[x]==-1){ vector<bool> b(101,false); if(x%2==0)b[0]=true; else b[solve(x/2)^solve(x/2+1)]=true; if(x%3==0)b[solve(x/3)]=true; else if(x%3==1)b[solve(x/3+1)]=true; else b[solve(x/3)]=true; memo[x]=0; while(b[memo[x]])memo[x]++; } return memo[x]; } int main(){ ll n;cin >> n; memo[0]=0; memo[1]=0; memo[2]=1; if(solve(n))cout << "A"; else cout << "B"; }