結果

問題 No.513 宝探し2
ユーザー rlangevinrlangevin
提出日時 2023-01-26 01:03:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 102 ms / 2,000 ms
コード長 1,741 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 87,752 KB
平均クエリ数 43.92
最終ジャッジ日時 2023-09-24 03:08:42
合計ジャッジ時間 2,429 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
87,136 KB
testcase_01 AC 97 ms
87,248 KB
testcase_02 AC 96 ms
87,476 KB
testcase_03 AC 99 ms
87,312 KB
testcase_04 AC 97 ms
87,428 KB
testcase_05 AC 94 ms
87,752 KB
testcase_06 AC 93 ms
87,244 KB
testcase_07 AC 97 ms
86,888 KB
testcase_08 AC 91 ms
87,440 KB
testcase_09 AC 93 ms
87,344 KB
testcase_10 AC 92 ms
87,320 KB
testcase_11 AC 93 ms
87,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

M = 10 ** 5

print(0, 0, flush=True)
a = int(input())
if a == 0:
    exit()
print(1, 0, flush=True)
b = int(input())
if b == 0:
    exit()
print(M - 1, 0, flush=True)
c = int(input())
if c == 0:
    exit()
print(M, 0, flush=True)
d = int(input())
if d == 0:
    exit()
    
if a < b:
    left = right = 0
elif c > d:
    left = right = M
else:
    left = 0
    right = M - 1
    while right - left != 1:
        mid = (left + right)//2
        print(mid, 0, flush=True)
        n1 = int(input())
        if n1 == 0:
            exit()
        print(mid + 1, 0, flush=True)
        n2 = int(input())
        if n2 == 0:
            exit()
        if n1 > n2:
            left = mid
        else:
            right = mid
            
      
            
print(0, 0, flush=True)
a = int(input())
if a == 0:
    exit()
print(0, 1, flush=True)
b = int(input())
if b == 0:
    exit()
print(0, M - 1, flush=True)
c = int(input())
if c == 0:
    exit()
print(0, M, flush=True)
d = int(input())
if d == 0:
    exit()
    
if a < b:
    up = down = 0
elif c > d:
    up = down = M
else:
    down = 0
    up = M - 1
    while up - down != 1:
        mid = (down + up)//2
        print(0, mid, flush=True)
        n1 = int(input())
        if n1 == 0:
            exit()
        print(0, mid + 1, flush=True)
        n2 = int(input())
        if n2 == 0:
            exit()
        if n1 > n2:
            down = mid
        else:
            up = mid
            
print(left, up, flush=True)
d = int(input())
if d == 0:
    exit()
    
print(left, down, flush=True)
d = int(input())
if d == 0:
    exit()
    
print(right, up, flush=True)
d = int(input())
if d == 0:
    exit()
    
print(right, down, flush=True)
d = int(input())
if d == 0:
    exit()
0