結果

問題 No.253 ロウソクの長さ
ユーザー qibqib
提出日時 2023-02-22 00:20:23
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 538 bytes
コンパイル時間 333 ms
コンパイル使用メモリ 87,028 KB
実行使用メモリ 87,868 KB
平均クエリ数 34.39
最終ジャッジ日時 2023-09-29 13:07:05
合計ジャッジ時間 6,266 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
87,368 KB
testcase_01 AC 80 ms
87,204 KB
testcase_02 AC 80 ms
87,436 KB
testcase_03 AC 82 ms
86,956 KB
testcase_04 AC 79 ms
87,108 KB
testcase_05 AC 76 ms
87,684 KB
testcase_06 AC 77 ms
87,684 KB
testcase_07 AC 80 ms
87,260 KB
testcase_08 AC 81 ms
87,536 KB
testcase_09 AC 84 ms
87,092 KB
testcase_10 AC 86 ms
87,028 KB
testcase_11 WA -
testcase_12 AC 80 ms
87,460 KB
testcase_13 WA -
testcase_14 AC 81 ms
87,128 KB
testcase_15 AC 83 ms
87,676 KB
testcase_16 AC 81 ms
87,676 KB
testcase_17 AC 84 ms
87,744 KB
testcase_18 WA -
testcase_19 AC 83 ms
87,676 KB
testcase_20 WA -
testcase_21 AC 83 ms
87,140 KB
testcase_22 AC 84 ms
87,520 KB
testcase_23 AC 83 ms
87,428 KB
testcase_24 AC 84 ms
87,024 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 82 ms
86,840 KB
testcase_28 AC 81 ms
87,232 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 81 ms
87,268 KB
testcase_33 WA -
testcase_34 AC 81 ms
87,092 KB
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

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 = 100
  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