結果

問題 No.513 宝探し2
コンテスト
ユーザー c-yan
提出日時 2020-11-25 07:30:19
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 534 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 333 ms
コンパイル使用メモリ 20,824 KB
実行使用メモリ 34,440 KB
平均クエリ数 49.00
最終ジャッジ日時 2026-03-31 16:45:27
合計ジャッジ時間 2,665 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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