結果

問題 No.2521 Don't be Same
ユーザー GOTKAKO
提出日時 2023-10-27 23:55:31
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,276 bytes
コンパイル時間 1,631 ms
コンパイル使用メモリ 193,216 KB
最終ジャッジ日時 2025-02-17 16:16:34
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int X,Y; cin >> X >> Y;
    if(abs(X-Y) != 1){
        cout << "First" << endl;
        while(true){
            if(X == Y) cout << "B" << endl;
            else if(Y == 0) cout << "A 1 " << X << endl;
            else if(X == 0) cout << "A 2 " << Y << endl;
            else if(X > Y){cout << "A 1 " << X-(Y+1) << endl; X -= X-(Y+1);}
            else{cout << "A 2 " << Y-(X+1) << endl; Y -= Y-(X+1);}

            char c; cin >> c;
            if(c == 'C' || c == 'D') return 0;

            int w,n; cin >> w >> n;
            if(w == 1) X -= n;
            else Y -= n;
        }       
    }
    else{
        cout << "Second" << endl;
        while(true){
            char c; cin >> c;
            if(c == 'C' || c == 'D') return 0;

            int w,n; cin >> w >> n;
            if(w == 1) X -= n;
            else Y -= n;

            if(X == Y) cout << "B" << endl;
            else if(Y == 0) cout << "A 1 " << X << endl;
            else if(X == 0) cout << "A 2 " << Y << endl;
            else if(X > Y){cout << "A 1 " << X-(Y+1) << endl; X -= X-(Y+1);}
            else{cout << "A 2 " << Y-(X+1) << endl; Y -= Y-(X+1);}
        }
    }
}
0