結果

問題 No.3246 80% Accuracy Calculator
コンテスト
ユーザー detteiuu
提出日時 2026-08-25 00:15:01
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 223 ms / 2,000 ms
+ 3µs
コード長 1,501 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 247 ms
コンパイル使用メモリ 96,096 KB
実行使用メモリ 86,912 KB
平均クエリ数 712.51
最終ジャッジ日時 2026-08-25 00:15:10
合計ジャッジ時間 9,362 ms
ジャッジサーバーID
(参考情報)
judge2_0 / <nil>
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from collections import defaultdict
from random import randrange
from time import sleep

# X, Y = map(int, input().split())
# ans = [X, Y, 0]

ABC = ["A", "B", "C"]
cnt = 60

def question(n):
    print("?", ABC[n])
    return int(input())
    # if randrange(10) <= 7:
    #     return ans[n]
    # else:
    #     return -1

def func(n):
    D = defaultdict(int)
    for _ in range(cnt):
        res = question(n)
        D[res] += 1
        if cnt//2+1 <= D[res]:
            return res
    raise ValueError("特定失敗")

def add(a, b, c):
    print("+", ABC[a], ABC[b], ABC[c])
    return int(input())
    # if randrange(10) <= 7:
    #     ans[c] = ans[a]+ans[b]
    # else:
    #     ans[c] = -1

def answer(n):
    print("!", ABC[n])
    # print(ans[n])

x = func(0)
y = func(1)
IDX = []
for i in range(10):
    if 1<<i & y:
        IDX.append(i)

# idx1: x^(1<<?)を保持している場所
# idx2: 空いている場所
# idx3: 現在の合計を保持している場所
idx1, idx2, idx3 = 0, 1, 2
idx = 0
SUM = 0
for i in range(10):
    m = i%2
    if IDX[idx] == i:
        SUM += x*(1<<i)
        while True:
            add(idx3, idx1, idx2)
            res = func(idx2)
            if res == SUM:
                break
        idx2, idx3 = idx3, idx2
        idx += 1
    if idx == len(IDX):
        break
    while True:
        nex = x*(1<<(i+1))
        add(idx1, idx1, idx2)
        res = func(idx2)
        if res == nex:
            break
    idx1, idx2 = idx2, idx1

answer(idx3)
0