結果

問題 No.3212 SUPER Guess the Number
コンテスト
ユーザー miya145592
提出日時 2025-07-27 03:58:27
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 71 ms / 2,000 ms
+ 999µs
コード長 739 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 76 ms
コンパイル使用メモリ 64,756 KB
実行使用メモリ 53,700 KB
平均クエリ数 22.85
最終ジャッジ日時 2026-10-15 03:57:35
合計ジャッジ時間 1,823 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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+1)//2
            l = c
            pre = now
        else:
            c = (pre+now+1)//2
            r = c-1
            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