結果

問題 No.253 ロウソクの長さ
ユーザー convexineqconvexineq
提出日時 2020-12-11 07:11:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 100 ms / 2,000 ms
コード長 592 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 86,892 KB
実行使用メモリ 87,572 KB
平均クエリ数 30.81
最終ジャッジ日時 2023-09-24 02:49:33
合計ジャッジ時間 5,940 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
87,196 KB
testcase_01 AC 93 ms
87,388 KB
testcase_02 AC 95 ms
87,480 KB
testcase_03 AC 94 ms
86,800 KB
testcase_04 AC 93 ms
86,616 KB
testcase_05 AC 95 ms
87,028 KB
testcase_06 AC 93 ms
86,984 KB
testcase_07 AC 94 ms
87,168 KB
testcase_08 AC 94 ms
87,408 KB
testcase_09 AC 93 ms
87,304 KB
testcase_10 AC 94 ms
87,572 KB
testcase_11 AC 95 ms
87,124 KB
testcase_12 AC 95 ms
86,736 KB
testcase_13 AC 98 ms
87,324 KB
testcase_14 AC 96 ms
86,976 KB
testcase_15 AC 97 ms
86,836 KB
testcase_16 AC 95 ms
87,416 KB
testcase_17 AC 92 ms
86,896 KB
testcase_18 AC 94 ms
87,476 KB
testcase_19 AC 91 ms
87,356 KB
testcase_20 AC 92 ms
87,360 KB
testcase_21 AC 92 ms
87,060 KB
testcase_22 AC 93 ms
87,036 KB
testcase_23 AC 94 ms
87,440 KB
testcase_24 AC 94 ms
86,804 KB
testcase_25 AC 96 ms
86,888 KB
testcase_26 AC 94 ms
87,024 KB
testcase_27 AC 93 ms
87,200 KB
testcase_28 AC 93 ms
87,256 KB
testcase_29 AC 95 ms
86,912 KB
testcase_30 AC 95 ms
86,920 KB
testcase_31 AC 94 ms
87,116 KB
testcase_32 AC 93 ms
87,360 KB
testcase_33 AC 97 ms
87,024 KB
testcase_34 AC 90 ms
86,832 KB
testcase_35 AC 96 ms
87,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def ask(k,t):
    print(f"? {k}")
    sys.stdout.flush()
    if DEBUG:
        if X-t < k: return -1
        elif k==X-t: return 0
        return 1
    else:
        return int(input())

def ans(k):
    print(f"! {k}")
    exit()

import sys
DEBUG = 0
if DEBUG: X = 1048576

a = ask(100,0)
if a == 0:
    ans(100)
if a == -1:
    for t in range(1,100):
        a = ask(9,t)
        if a==0:
            ans(t+9)
ng = 100
ok = 10**9+1
for t in range(1,100):
    mid = (ok+ng)//2
    a = ask(mid-t,t)
    if a == -1:
        ok = mid
    elif a == 1:
        ng = mid
    else:
        ans(mid)
0