結果

問題 No.513 宝探し2
ユーザー hedwig100hedwig100
提出日時 2020-05-28 12:00:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 551 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 10,976 KB
実行使用メモリ 24,560 KB
平均クエリ数 56.00
最終ジャッジ日時 2023-09-24 02:38:30
合計ジャッジ時間 1,396 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
23,908 KB
testcase_01 AC 38 ms
23,868 KB
testcase_02 AC 38 ms
24,208 KB
testcase_03 AC 35 ms
24,560 KB
testcase_04 AC 36 ms
23,980 KB
testcase_05 AC 32 ms
24,400 KB
testcase_06 AC 35 ms
24,356 KB
testcase_07 AC 35 ms
23,936 KB
testcase_08 AC 32 ms
24,220 KB
testcase_09 AC 34 ms
24,076 KB
testcase_10 AC 37 ms
23,932 KB
testcase_11 AC 36 ms
24,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def ask(x,y):
    print(x,y,flush = True)
    d = int(input())
    if d == 0:
        exit()
    return d

Lx = -1
Rx = 100001
while Rx - Lx > 1:
    Mx = (Rx + Lx)//2
    d1 = ask(Mx,0)
    d2 = ask(Mx + 1,0)
    if d1 < d2:
        Rx = Mx
    else:
        Lx = Mx

Ly = -1
Ry = 100001
while Ry - Ly > 1:
    My = (Ry + Ly)//2
    d1 = ask(0,My)
    d2 = ask(0,My + 1)
    if d1 < d2:
        Ry = My
    else:
        Ly = My

ask(Rx,Ry)
ask(Lx,Ly)
ask(Rx,Ly)
ask(Lx,Ry)
0