結果
問題 |
No.3212 SUPER Guess the Number
|
ユーザー |
![]() |
提出日時 | 2025-07-25 22:50:28 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 77 ms / 2,000 ms |
コード長 | 754 bytes |
コンパイル時間 | 429 ms |
コンパイル使用メモリ | 82,160 KB |
実行使用メモリ | 70,796 KB |
平均クエリ数 | 21.83 |
最終ジャッジ日時 | 2025-07-25 22:50:36 |
合計ジャッジ時間 | 2,217 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 |
ソースコード
def binary_search(f): left,right=1,10**6+1 while right-left>1: mid=(right+left)//2 if f(mid): right=mid else: left=mid return left a = 21 def ask(x,x_d): print('?', x_d) return int(input()) if abs(a-x) >= abs(a-x_d): print("1") return 1 return 0 def f(x): global s if s < 0: s_d = s+abs(s-x)*2 else: s_d = s-abs(s-x)*2-1 r=ask(s,s_d) s = s_d if r == -1: assert False if r == 1: if s < 0: return True else: return False else: if s < 0: return False else: return True s = 10**7 print('?', s) a=binary_search(f) print('!', a)