結果

問題 No.3246 80% Accuracy Calculator
ユーザー 👑 loop0919
提出日時 2025-08-22 22:19:33
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 859 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 82,152 KB
実行使用メモリ 95,868 KB
平均クエリ数 634.07
最終ジャッジ日時 2025-08-22 22:19:50
合計ジャッジ時間 7,590 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 41 RE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

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


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

    for _ in range(10):
        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
    add(ans_pos, ans_pos, tmp_pos)
    ans_pos, tmp_pos = tmp_pos, ans_pos

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