結果
問題 |
No.253 ロウソクの長さ
|
ユーザー |
![]() |
提出日時 | 2022-08-01 04:29:37 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 57 ms / 2,000 ms |
コード長 | 550 bytes |
コンパイル時間 | 364 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 27,864 KB |
平均クエリ数 | 24.44 |
最終ジャッジ日時 | 2024-07-17 03:09:38 |
合計ジャッジ時間 | 4,234 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 36 |
ソースコード
import sys readline=sys.stdin.readline def Interactive(*query): print(*query) sys.stdout.flush() return input() def Bisect_Int(ok,ng,is_ok): while abs(ok-ng)>1: mid=(ok+ng)//2 if is_ok(mid): ok=mid else: ng=mid return ok cnt=0 def is_ok(x): global cnt retu=int(Interactive("?",x-cnt)) if retu==0: print("!",x) exit() cnt+=1 return retu>=1 ans=Bisect_Int(10,1<<7,is_ok) if ans==127: ans=Bisect_Int(127,1<<30,is_ok) else: print("!",ans)