結果

問題 No.253 ロウソクの長さ
ユーザー rpy3cpprpy3cpp
提出日時 2015-07-24 23:32:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 466 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 10,752 KB
実行使用メモリ 24,432 KB
平均クエリ数 21.19
最終ジャッジ日時 2023-09-23 05:00:58
合計ジャッジ時間 5,580 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
24,316 KB
testcase_01 AC 37 ms
23,952 KB
testcase_02 AC 38 ms
24,048 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 39 ms
24,060 KB
testcase_07 AC 40 ms
23,412 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 39 ms
24,024 KB
testcase_11 AC 39 ms
23,772 KB
testcase_12 AC 40 ms
24,336 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 41 ms
23,552 KB
testcase_19 AC 38 ms
23,440 KB
testcase_20 AC 40 ms
23,884 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 39 ms
23,940 KB
testcase_26 AC 40 ms
23,616 KB
testcase_27 AC 39 ms
23,640 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 41 ms
23,964 KB
testcase_32 AC 40 ms
23,636 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

lower = 0
upper = 10**9 + 1
mid = 200
n_query = 0
while lower + 1 < upper:
    n_query += 1
    print('? {}'.format(mid), flush=True)
    ans = int(input())
    if ans == 0:
        print('! {}'.format(mid + n_query), flush=True)
        break
    if ans == 1:
        lower = mid
        upper -= 1
    if ans == -1:
        upper = mid - 1
        lower = max(0, lower - 1)
    mid = (lower + upper) // 2
else:
    print('! {}'.format(lower + n_query), flush=True)
0