結果

問題 No.253 ロウソクの長さ
ユーザー ynyn
提出日時 2016-08-28 03:22:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 602 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 87,240 KB
実行使用メモリ 87,912 KB
平均クエリ数 28.61
最終ジャッジ日時 2023-09-23 11:22:15
合計ジャッジ時間 8,520 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 94 ms
87,244 KB
testcase_02 WA -
testcase_03 AC 93 ms
87,684 KB
testcase_04 AC 95 ms
86,844 KB
testcase_05 AC 94 ms
86,800 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 92 ms
87,680 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 92 ms
87,456 KB
testcase_15 WA -
testcase_16 AC 93 ms
86,796 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 92 ms
87,576 KB
testcase_20 WA -
testcase_21 AC 93 ms
87,048 KB
testcase_22 AC 95 ms
87,428 KB
testcase_23 WA -
testcase_24 AC 92 ms
87,488 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 92 ms
87,424 KB
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def ask(y):
    print("?", y)
    sys.stdout.flush()
    ret = int(input())
    return ret

def ans(y):
    print("!", y)
    sys.stdout.flush()
    return None

if ask(80) == -1:
    for i in range(80):
        if ask(9) == 0:
            print("!", 9 + i + 1)
            sys.stdout.flush()
            exit()

else:
    high = 10 ** 9
    low = 0
    num = 1

    while low < high:
        mid = (low + high) // 2
        x = ask(mid - num)
        if x == 0:
            ans(mid)
            exit()

        elif x == -1:
            high = mid

        else:
            low = mid + 1
0