結果

問題 No.2521 Don't be Same
ユーザー RubikunRubikun
提出日時 2023-10-27 22:03:06
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,932 bytes
コンパイル時間 1,924 ms
コンパイル使用メモリ 204,236 KB
実行使用メモリ 95,496 KB
平均クエリ数 1.04
最終ジャッジ日時 2023-10-27 22:03:17
合計ジャッジ時間 6,373 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
24,624 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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();
    }
}
0