結果
問題 |
No.3212 SUPER Guess the Number
|
ユーザー |
![]() |
提出日時 | 2025-07-26 02:18:29 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 64 ms / 2,000 ms |
コード長 | 625 bytes |
コンパイル時間 | 347 ms |
コンパイル使用メモリ | 82,044 KB |
実行使用メモリ | 71,396 KB |
平均クエリ数 | 23.92 |
最終ジャッジ日時 | 2025-07-26 02:18:32 |
合計ジャッジ時間 | 2,317 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 |
ソースコード
def question(x): print("?", x) OUTPUT.append(x) if 2 <= len(OUTPUT): return int(input()) def answer(a): print("!", a) OUTPUT = [] l, r = 1, 10**6 question(l) ans = question(r) if ans == 0: r = (l+r)//2 else: l = (l+r+1)//2 while l+1 < r: p = OUTPUT[-1] mid = (l+r)//2 ans = question(p+(mid-p)*2) if ans == 0: if OUTPUT[-2] < OUTPUT[-1]: r = mid else: l = mid else: if OUTPUT[-2] < OUTPUT[-1]: l = mid else: r = mid question(l) ans = question(r) if ans == 0: answer(l) else: answer(r)