結果

問題 No.253 ロウソクの長さ
ユーザー ynyn
提出日時 2016-08-28 03:35:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 573 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 86,996 KB
実行使用メモリ 87,812 KB
平均クエリ数 28.44
最終ジャッジ日時 2023-09-24 00:29:04
合計ジャッジ時間 5,125 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
87,708 KB
testcase_01 AC 83 ms
87,528 KB
testcase_02 AC 80 ms
87,764 KB
testcase_03 AC 87 ms
87,048 KB
testcase_04 AC 81 ms
87,428 KB
testcase_05 AC 83 ms
87,444 KB
testcase_06 AC 82 ms
87,128 KB
testcase_07 AC 82 ms
87,508 KB
testcase_08 AC 86 ms
87,088 KB
testcase_09 AC 86 ms
87,812 KB
testcase_10 AC 81 ms
87,504 KB
testcase_11 AC 82 ms
87,184 KB
testcase_12 AC 83 ms
87,448 KB
testcase_13 AC 83 ms
87,000 KB
testcase_14 AC 82 ms
87,372 KB
testcase_15 AC 82 ms
87,180 KB
testcase_16 AC 83 ms
87,192 KB
testcase_17 AC 83 ms
87,524 KB
testcase_18 AC 83 ms
87,204 KB
testcase_19 AC 81 ms
87,424 KB
testcase_20 AC 84 ms
87,112 KB
testcase_21 AC 84 ms
86,884 KB
testcase_22 AC 81 ms
87,344 KB
testcase_23 AC 84 ms
87,004 KB
testcase_24 AC 85 ms
87,248 KB
testcase_25 AC 89 ms
86,920 KB
testcase_26 AC 83 ms
87,564 KB
testcase_27 AC 82 ms
87,136 KB
testcase_28 AC 87 ms
87,472 KB
testcase_29 AC 84 ms
86,732 KB
testcase_30 AC 82 ms
86,836 KB
testcase_31 AC 82 ms
86,836 KB
testcase_32 AC 84 ms
87,056 KB
testcase_33 AC 84 ms
86,684 KB
testcase_34 AC 79 ms
87,392 KB
testcase_35 AC 88 ms
87,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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
0