結果

問題 No.3212 SUPER Guess the Number
ユーザー nikoro256
提出日時 2025-07-25 22:24:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 569 bytes
コンパイル時間 398 ms
コンパイル使用メモリ 82,904 KB
実行使用メモリ 71,964 KB
平均クエリ数 22.00
最終ジャッジ日時 2025-07-25 22:24:40
合計ジャッジ時間 3,106 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

def binary_search(f):
    left,right=0,10**6+1
    while right-left>1:
        mid=(right+left)//2
        if f(mid):
            left=mid
        else:
            right=mid
    return left

a = 100
def ask(x,x_d):
    print('?', x_d)
    return int(input())
    if abs(a-x) >= abs(a-x_d):
        print("1")
        return 1
    x = x_d
    return 0

def f(x):
    s_d = x-(s-x)
    if s_d < 0:
        s_d -= 1
    else:
        s_d += 1
    r=ask(s,s_d)
    if r == 1:
        return False
    return True



s = 10**6
print('?', s)
a=binary_search(f)
print('!', a)
0