結果

問題 No.3212 SUPER Guess the Number
ユーザー miya145592
提出日時 2025-07-27 03:51:37
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 735 bytes
コンパイル時間 254 ms
コンパイル使用メモリ 82,732 KB
実行使用メモリ 71,352 KB
平均クエリ数 21.83
最終ジャッジ日時 2025-07-27 03:51:40
合計ジャッジ時間 3,147 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
l = 0
r = 10**6
pre = (r-l)//2
print("?", pre, flush=True)
for _ in range(24):
    c = (l+r)//2
    dif = c-pre
    now = c+dif
    if dif==0:
        now += 1
    #print(l, r, pre, now)
    print("?", now, flush=True)
    ret = int(input())
    if ret==-1:
        exit()
    if pre<now:
        if ret==1:
            c = (pre+now)//2
            l = c+1
            pre = now
        else:
            c = (pre+now)//2
            r = c
            pre = now
    else:
        if ret==1:
            c = (pre+now)//2
            r = c
            pre = now
        else:
            c = (pre+now)//2
            l = c+1
            pre = now
    if l==r:
        break
print("!", l, flush=True)
0