結果
| 問題 |
No.153 石の山
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-02-10 18:08:04 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 921 bytes |
| コンパイル時間 | 3,178 ms |
| コンパイル使用メモリ | 278,420 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2025-02-10 18:08:09 |
| 合計ジャッジ時間 | 4,561 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 WA * 7 |
ソースコード
#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)]=true;
b[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";
}