結果

問題 No.2521 Don't be Same
ユーザー rin204
提出日時 2023-10-27 22:18:23
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 784 bytes
コンパイル時間 228 ms
コンパイル使用メモリ 81,848 KB
実行使用メモリ 82,932 KB
平均クエリ数 2.36
最終ジャッジ日時 2024-09-25 14:21:26
合計ジャッジ時間 4,994 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 1
other AC * 10 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

X = list(map(int, input().split()))


def f():
    res = input().split()
    if res[0] == "A":
        X[int(res[1]) - 1] -= int(res[2])
    elif res[0] == "B":
        exit()
    else:
        exit()


def ask(Q, i=None, j=None):
    global X
    if Q == "A":
        print("A", i, j, flush=True)
        X[i - 1] -= j
    else:
        print("B", flush=True)
        X = [0, 0]
    f()


if abs(X[0] - X[1]) == 1 and min(X) % 2 == 1:
    print("Second", flush=True)
    f()
else:
    print("First", flush=True)

while 1:
    if X[0] == X[1]:
        ask("B")
    else:
        if X[0] <= X[1]:
            t = 1
        else:
            t = 0
        if X[t] % 2 == 1:
            ask("A", t + 1, X[t] - X[1 - t] + 1)
        else:
            ask("A", t + 1, X[t] - X[1 - t] - 1)
0