結果
問題 |
No.253 ロウソクの長さ
|
ユーザー |
![]() |
提出日時 | 2016-08-28 03:35:41 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 79 ms / 2,000 ms |
コード長 | 573 bytes |
コンパイル時間 | 323 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 69,336 KB |
平均クエリ数 | 28.44 |
最終ジャッジ日時 | 2024-07-17 00:21:58 |
合計ジャッジ時間 | 4,919 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 36 |
ソースコード
import sys def ask(y): print("?", y) sys.stdout.flush() ret = int(input()) return ret def ans(y): print("!", y) sys.stdout.flush() exit() x = ask(80) if x == 0: ans(80) elif x == -1: for i in range(80): if ask(9) == 0: ans(9 + i + 1) else: high = 10 ** 9 + 1 low = 80 num = 1 while low < high: mid = (low + high) // 2 x = ask(mid - num) if x == 0: ans(mid) num += 1 if x == -1: high = mid else: low = mid + 1