結果

問題 No.253 ロウソクの長さ
ユーザー qibqib
提出日時 2023-02-22 00:08:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 536 bytes
コンパイル時間 382 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 87,972 KB
平均クエリ数 34.36
最終ジャッジ日時 2023-09-29 13:01:49
合計ジャッジ時間 7,850 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 100 ms
86,668 KB
testcase_02 AC 102 ms
86,948 KB
testcase_03 AC 98 ms
87,276 KB
testcase_04 AC 96 ms
86,952 KB
testcase_05 AC 101 ms
87,384 KB
testcase_06 AC 99 ms
87,080 KB
testcase_07 AC 99 ms
86,836 KB
testcase_08 WA -
testcase_09 AC 95 ms
87,272 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 97 ms
87,240 KB
testcase_13 WA -
testcase_14 AC 97 ms
87,360 KB
testcase_15 AC 101 ms
87,316 KB
testcase_16 AC 95 ms
87,276 KB
testcase_17 AC 94 ms
87,436 KB
testcase_18 WA -
testcase_19 AC 95 ms
87,620 KB
testcase_20 WA -
testcase_21 AC 99 ms
87,256 KB
testcase_22 AC 98 ms
87,192 KB
testcase_23 AC 97 ms
87,312 KB
testcase_24 AC 98 ms
87,312 KB
testcase_25 AC 98 ms
87,308 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 99 ms
86,796 KB
testcase_30 AC 95 ms
87,456 KB
testcase_31 WA -
testcase_32 AC 97 ms
87,224 KB
testcase_33 WA -
testcase_34 AC 95 ms
87,128 KB
testcase_35 AC 97 ms
87,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

mem = []
print("? 100")
sys.stdout.flush()
res = int(input())
mem.append((100, res))

if res == -1:
  while res != 0:
    print("? 1")
    sys.stdout.flush()
    res = int(input())
    mem.append((1, res))
elif res == 1:
  ng = 0
  ok = 10 ** 9
  while ok - ng > 1:
    mid = (ok + ng) // 2
    print(f"? {mid - len(mem)}")
    sys.stdout.flush()
    res = int(input())
    mem.append((mid - len(mem), res))

    if res < 0:
      ok = mid
    else:
      ng = mid

print(f"! {mem[-1][0] + len(mem) - 1}")
sys.stdout.flush()
0