結果

問題 No.2521 Don't be Same
ユーザー Carpenters-CatCarpenters-Cat
提出日時 2023-10-28 00:41:46
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 927 bytes
コンパイル時間 2,253 ms
コンパイル使用メモリ 203,248 KB
実行使用メモリ 24,648 KB
平均クエリ数 9.79
最終ジャッジ日時 2023-10-28 00:41:53
合計ジャッジ時間 5,344 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using Pi = pair<int, int>;
Pi printQ(int x, int y) {
	if (x == y) {
		cout << "B" << endl;
		return Pi{0, 0};
	}
	int id = 1;
	if (x < y) {
		id ++;
		swap(x, y);
	}
	if (y == 0) {
		cout << "A " << id << " " << x << endl;
		return Pi{id, x};
	}
	int d = x - y;
	if (y & 1) {
		d --;
	} else {
		d ++;
	}
	cout << "A " << id << " " << d << endl;
	return Pi{id, d};
}
int main() {
	int X, Y;
	cin >> X >> Y;
	if (abs(X - Y) == 1 && (X + Y) & 3 == 3) {
		cout << "Second" << endl;
	} else {
		cout << "First" << endl;
		auto [id, d] = printQ(X, Y);
		((id - 1) ? Y : X) -= d;
	}
	while (true) {
		char c;
		cin >> c;
		if (c == 'C') {
			return 0;
		} else if (c == 'D') {
			return 0;
		} else if (c == 'B') {
			return 0;
		} else {
			assert(c == 'A');
			int id, d;
			cin >> id >> d;
			((id - 1) ? Y : X) -= d;
		}
		auto [id, d] = printQ(X, Y);
		((id - 1) ? Y : X) -= d;
	}
}
0