結果
問題 | No.2521 Don't be Same |
ユーザー |
![]() |
提出日時 | 2023-10-27 22:03:06 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,932 bytes |
コンパイル時間 | 2,166 ms |
コンパイル使用メモリ | 195,812 KB |
最終ジャッジ日時 | 2025-02-17 15:02:52 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | RE * 7 TLE * 1 -- * 19 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long ll;template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }#define all(x) (x).begin(),(x).end()#define fi first#define se second#define mp make_pair#define si(x) int(x.size())const int mod=998244353,MAX=300005,INF=1<<30;bool solve(int a,int b){if(a==0&&b==0) return false;if(a==0||b==0) return true;if(a==b) return true;if(a){for(int k=1;k<=a;k++){if(!solve(a-k,b)) return true;}}if(b){for(int k=1;k<=b;k++){if(!solve(a,b-k)) return true;}}return false;}int main(){for(int a=0;a<=10;a++){for(int b=0;b<=10;b++){//cout<<solve(a,b)<<" ";}//cout<<endl;}int X,Y;cin>>X>>Y;auto mov=[&](){if(X==Y) cout<<"B"<<endl;else if(X==0) cout<<"A"<<" "<<2<<" "<<Y<<endl;else if(Y==0) cout<<"A"<<" "<<1<<" "<<X<<endl;else{if(Y%2==0&&X>Y-1) cout<<"A"<<" "<<1<<" "<<X-(Y-1)<<endl;else if(Y%2==1&&X>Y+1) cout<<"A"<<" "<<1<<" "<<X-(Y+1)<<endl;else if(X%2==0&&Y>X-1) cout<<"A"<<" "<<2<<" "<<Y-(X-1)<<endl;else if(X%2==1&&Y>X+1) cout<<"A"<<" "<<2<<" "<<Y-(X+1)<<endl;else exit(1);}};auto wait=[&](){char c;cin>>c;if(c=='C') exit(0);if(c=='D') exit(1);if(c=='A'){ll a,b;cin>>a>>b;if(a==1) X-=b;else Y-=b;}else{X=0;Y=0;}};if((X+1==Y&&Y%2==0)||(Y+1==X&&X%2==0)){cout<<"Second"<<endl;wait();}else{cout<<"First"<<endl;}while(1){mov();wait();}}