結果

問題 No.3246 80% Accuracy Calculator
ユーザー 👑 loop0919
提出日時 2025-08-22 22:28:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 885 bytes
コンパイル時間 235 ms
コンパイル使用メモリ 82,384 KB
実行使用メモリ 96,776 KB
平均クエリ数 2329.53
最終ジャッジ日時 2025-08-22 22:28:37
合計ジャッジ時間 11,048 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22 WA * 6 RE * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

STR_MAP = ["A", "B", "C"]
val = [0, 0, 0]


def get_value(pos):
    cand = defaultdict(int)

    for _ in range(3):
        print("?", STR_MAP[pos])
        cand[int(input())] += 1

    return [v for v, c in cand.items() if c == max(cand.values())][0]


def add(pos_0, pos_1, pos_2):
    while True:
        print("+", STR_MAP[pos_0], STR_MAP[pos_1], STR_MAP[pos_2])
        input()
        if val[pos_0] + val[pos_1] == get_value(pos_2):
            val[pos_2] = val[pos_0] + val[pos_1]
            break


X = val[0] = get_value(0)
Y = val[1] = get_value(1)

ans_pos = 2
tmp_pos = 1

for i in range(9, -1, -1):
    if (Y >> i) & 1 == 1:
        add(0, ans_pos, tmp_pos)
        ans_pos, tmp_pos = tmp_pos, ans_pos
    
    if i > 0:
        add(ans_pos, ans_pos, tmp_pos)
        ans_pos, tmp_pos = tmp_pos, ans_pos

print("!", STR_MAP[ans_pos])
0