結果

問題 No.594 壊れた宝物発見機
ユーザー rlangevinrlangevin
提出日時 2024-03-12 12:20:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 164 ms / 2,000 ms
コード長 1,295 bytes
コンパイル時間 226 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 69,468 KB
平均クエリ数 104.10
最終ジャッジ日時 2024-03-12 12:20:35
合計ジャッジ時間 5,372 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 155 ms
69,468 KB
testcase_01 AC 151 ms
69,468 KB
testcase_02 AC 153 ms
69,468 KB
testcase_03 AC 156 ms
69,468 KB
testcase_04 AC 152 ms
69,468 KB
testcase_05 AC 153 ms
69,468 KB
testcase_06 AC 153 ms
69,468 KB
testcase_07 AC 152 ms
69,468 KB
testcase_08 AC 149 ms
69,468 KB
testcase_09 AC 151 ms
69,468 KB
testcase_10 AC 156 ms
69,468 KB
testcase_11 AC 150 ms
69,468 KB
testcase_12 AC 151 ms
69,468 KB
testcase_13 AC 164 ms
69,468 KB
testcase_14 AC 155 ms
69,468 KB
testcase_15 AC 154 ms
69,468 KB
testcase_16 AC 158 ms
69,468 KB
testcase_17 AC 157 ms
69,468 KB
testcase_18 AC 156 ms
69,468 KB
testcase_19 AC 154 ms
69,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

lx, rx = -150, 150
ly, ry = -150, 150
lz, rz = -150, 150
while rx - lx > 2:
    c1, c2 = (lx * 2 + rx)//3, (lx + rx * 2)//3
    print("? {} {} {}".format(c1, ly, lz))
    sys.stdout.flush()
    f1 = int(input())
    print("? {} {} {}".format(c2, ly, lz))
    sys.stdout.flush()
    f2 = int(input())
    if f1 >= f2:
        lx = c1
    else:
        rx = c2
        
while ry - ly > 2:
    c1, c2 = (ly * 2 + ry)//3, (ly + ry * 2)//3
    print("? {} {} {}".format(lx, c1, lz))
    sys.stdout.flush()
    f1 = int(input())
    print("? {} {} {}".format(lx, c2, lz))
    sys.stdout.flush()
    f2 = int(input())
    if f1 >= f2:
        ly = c1
    else:
        ry = c2
    
while rz - lz > 2:
    c1, c2 = (lz * 2 + rz)//3, (lz + rz * 2)//3
    print("? {} {} {}".format(lx, ly, c1))
    sys.stdout.flush()
    f1 = int(input())
    print("? {} {} {}".format(lx, ly, c2))
    sys.stdout.flush()
    f2 = int(input())
    if f1 >= f2:
        lz = c1
    else:
        rz = c2
        
ans = []
minv = 10 ** 18
for x in range(lx, rx + 1):
    for y in range(ly, ry + 1):
        for z in range(lz, rz + 1):
            print("? {} {} {}".format(x, y, z))
            d = int(input())
            if d <= minv:
                minv = d
                ans = ["!", x, y, z]
print(*ans)
0