結果

問題 No.513 宝探し2
ユーザー kohei2019kohei2019
提出日時 2022-05-15 13:28:47
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 522 bytes
コンパイル時間 367 ms
コンパイル使用メモリ 87,160 KB
実行使用メモリ 95,412 KB
平均クエリ数 87.83
最終ジャッジ日時 2023-10-09 21:46:28
合計ジャッジ時間 5,028 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 107 ms
86,612 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 103 ms
86,884 KB
testcase_09 AC 106 ms
87,088 KB
testcase_10 RE -
testcase_11 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

# 整数版三分探索実装

def func(arg):
    print(arg,0)
    a = int(input())
    if a == 0:
        exit()
    return a

def sanbunntan(l,r):
    while l + 2 < r:
        c1 = l+(r-l)//3
        c2 = r-(r-l)//3
        if func(c1)<func(c2):
            r = c2
        else:
            l = c1
    val = sorted([(func(i),i) for i in range(l,r+1)])[0][1]

x = sanbunntan(0, 100001)

def func(arg):
    print(0,arg)
    a = int(input())
    if a == 0:
        exit()
    return a

y = sanbunntan(0, 100001)

print(x,y)
0