結果

問題 No.3212 SUPER Guess the Number
ユーザー otoshigo
提出日時 2025-07-25 22:35:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 501 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 82,648 KB
実行使用メモリ 70,932 KB
平均クエリ数 23.83
最終ジャッジ日時 2025-07-25 22:35:31
合計ジャッジ時間 1,823 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

MIN = 1
MAX = 10 ** 6
print('?', MIN)
X = [MIN]
l = MIN
r = MAX
while r - l > 1:
    x = l + r - X[-1]
    print('?', x)
    c = int(input())
    if c == 1:
        if x < X[-1]:
            r = (x + X[-1]) // 2
        else:
            l = (x + X[-1]) // 2
    else:
        if x < X[-1]:
            l = (x + X[-1]) // 2
        else:
            r = (x + X[-1]) // 2
    X.append(x)
print('?', l)
c = int(input())
print('?', r)
c = int(input())
if c == 1:
    print('!', r)
else:
    print('!', l)
0