結果

問題 No.253 ロウソクの長さ
ユーザー vwxyzvwxyz
提出日時 2022-08-01 04:29:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 550 bytes
コンパイル時間 107 ms
コンパイル使用メモリ 10,968 KB
実行使用メモリ 24,372 KB
平均クエリ数 24.44
最終ジャッジ日時 2023-09-24 03:04:46
合計ジャッジ時間 3,819 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
24,372 KB
testcase_01 AC 39 ms
23,952 KB
testcase_02 AC 39 ms
23,948 KB
testcase_03 AC 39 ms
23,780 KB
testcase_04 AC 39 ms
23,784 KB
testcase_05 AC 39 ms
24,160 KB
testcase_06 AC 40 ms
24,128 KB
testcase_07 AC 41 ms
23,836 KB
testcase_08 AC 40 ms
24,024 KB
testcase_09 AC 39 ms
23,892 KB
testcase_10 AC 40 ms
23,832 KB
testcase_11 AC 40 ms
23,992 KB
testcase_12 AC 40 ms
23,928 KB
testcase_13 AC 41 ms
23,888 KB
testcase_14 AC 39 ms
24,024 KB
testcase_15 AC 39 ms
24,008 KB
testcase_16 AC 39 ms
23,976 KB
testcase_17 AC 39 ms
23,724 KB
testcase_18 AC 41 ms
24,116 KB
testcase_19 AC 40 ms
23,896 KB
testcase_20 AC 40 ms
23,844 KB
testcase_21 AC 38 ms
24,040 KB
testcase_22 AC 39 ms
23,768 KB
testcase_23 AC 40 ms
24,348 KB
testcase_24 AC 38 ms
23,792 KB
testcase_25 AC 40 ms
23,728 KB
testcase_26 AC 41 ms
24,160 KB
testcase_27 AC 41 ms
24,324 KB
testcase_28 AC 40 ms
23,916 KB
testcase_29 AC 40 ms
24,320 KB
testcase_30 AC 40 ms
23,744 KB
testcase_31 AC 39 ms
24,092 KB
testcase_32 AC 39 ms
24,024 KB
testcase_33 AC 40 ms
24,352 KB
testcase_34 AC 39 ms
23,592 KB
testcase_35 AC 40 ms
24,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline=sys.stdin.readline

def Interactive(*query):
    print(*query)
    sys.stdout.flush()
    return input()

def Bisect_Int(ok,ng,is_ok):
    while abs(ok-ng)>1:
        mid=(ok+ng)//2
        if is_ok(mid):
            ok=mid
        else:
            ng=mid
    return ok

cnt=0
def is_ok(x):
    global cnt
    retu=int(Interactive("?",x-cnt))
    if retu==0:
        print("!",x)
        exit()
    cnt+=1
    return retu>=1

ans=Bisect_Int(10,1<<7,is_ok)
if ans==127:
    ans=Bisect_Int(127,1<<30,is_ok)
else:
    print("!",ans)
0