結果

問題 No.513 宝探し2
ユーザー c-yan
提出日時 2020-11-25 07:30:19
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 534 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 27,352 KB
平均クエリ数 49.00
最終ジャッジ日時 2024-07-17 02:55:41
合計ジャッジ時間 1,763 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

cache = {}
def query(x, y):
    if (x, y) in cache:
        return cache[x, y]
    print(x, y)
    result = int(input())
    cache[x, y] = result
    if result == 0:
        exit()
    return result

l = 0
r = 100000
while r - l >= 3:
    c1 = (l * 2 + r) // 3
    c2 = (l + r * 2) // 3
    if query(c1, 0) > query(c2, 0):
        l = c1
    else:
        r = c2

mv = query(l, 0)
mi = l
for j in range(l + 1, r + 1):
    if query(j, 0) >= mv:
        continue
    mv = query(j, 0)
    mi = j
AX = mi

AY = query(AX, 0)
query(AX, AY)
0