結果

問題 No.2521 Don't be Same
ユーザー SSRSSSRS
提出日時 2023-10-27 22:46:22
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 1,074 bytes
コンパイル時間 2,104 ms
コンパイル使用メモリ 202,484 KB
実行使用メモリ 24,552 KB
平均クエリ数 9.57
最終ジャッジ日時 2023-10-27 22:46:30
合計ジャッジ時間 5,719 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
24,540 KB
testcase_01 AC 57 ms
24,552 KB
testcase_02 AC 57 ms
24,552 KB
testcase_03 AC 57 ms
24,552 KB
testcase_04 AC 55 ms
24,552 KB
testcase_05 AC 57 ms
24,552 KB
testcase_06 AC 59 ms
24,552 KB
testcase_07 AC 57 ms
24,552 KB
testcase_08 AC 57 ms
24,552 KB
testcase_09 AC 59 ms
24,552 KB
testcase_10 AC 65 ms
24,552 KB
testcase_11 AC 58 ms
24,552 KB
testcase_12 AC 57 ms
24,552 KB
testcase_13 AC 57 ms
24,552 KB
testcase_14 AC 54 ms
24,552 KB
testcase_15 AC 54 ms
24,552 KB
testcase_16 AC 55 ms
24,552 KB
testcase_17 AC 58 ms
24,552 KB
testcase_18 AC 57 ms
24,552 KB
testcase_19 AC 57 ms
24,552 KB
testcase_20 AC 60 ms
24,552 KB
testcase_21 AC 58 ms
24,552 KB
testcase_22 AC 60 ms
24,552 KB
testcase_23 AC 64 ms
24,552 KB
testcase_24 AC 57 ms
24,552 KB
testcase_25 AC 56 ms
24,552 KB
testcase_26 AC 57 ms
24,552 KB
testcase_27 AC 61 ms
24,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  int X, Y;
  cin >> X >> Y;
  bool first = false;
  if (X != Y && (X - 1) / 2 == (Y - 1) / 2){
    cout << "Second" << endl;
  } else {
    cout << "First" << endl;
    first = true;
  }
  while (true){
    if (first){
      if (X == 0){
        cout << "A " << 2 << ' ' << Y << endl;
        Y = 0;
      } else if (Y == 0){
        cout << "A " << 1 << ' ' << X << endl;
        X = 0;
      } else if (X == Y){
        cout << "B" << endl;
        X = 0;
        Y = 0;
      } else if (X > Y){
        int X2 = ((Y - 1) ^ 1) + 1;
        cout << "A " << 1 << ' ' << X - X2 << endl;
        X = X2;
      } else {
        int Y2 = ((X - 1) ^ 1) + 1;
        cout << "A " << 2 << ' ' << Y - Y2 << endl;
        Y = Y2;
      }
    } else {
      char c;
      cin >> c;
      if (c == 'A'){
        int i, x;
        cin >> i >> x;
        if (i == 1){
          X -= x;
        }
        if (i == 2){
          Y -= x;
        }
      }
      if (c == 'C'){
        break;
      }
    }
    first = !first;
  }
}
0