結果

問題 No.594 壊れた宝物発見機
ユーザー Akijin_007Akijin_007
提出日時 2023-10-06 14:10:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 211 ms / 2,000 ms
コード長 1,582 bytes
コンパイル時間 369 ms
コンパイル使用メモリ 87,220 KB
実行使用メモリ 87,856 KB
平均クエリ数 88.00
最終ジャッジ日時 2023-10-06 14:10:46
合計ジャッジ時間 5,694 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 211 ms
87,032 KB
testcase_01 AC 187 ms
87,244 KB
testcase_02 AC 186 ms
86,800 KB
testcase_03 AC 200 ms
87,292 KB
testcase_04 AC 177 ms
87,088 KB
testcase_05 AC 186 ms
87,204 KB
testcase_06 AC 179 ms
87,372 KB
testcase_07 AC 173 ms
87,668 KB
testcase_08 AC 178 ms
87,432 KB
testcase_09 AC 201 ms
86,964 KB
testcase_10 AC 179 ms
87,228 KB
testcase_11 AC 176 ms
87,292 KB
testcase_12 AC 177 ms
87,700 KB
testcase_13 AC 181 ms
87,856 KB
testcase_14 AC 176 ms
87,188 KB
testcase_15 AC 195 ms
86,972 KB
testcase_16 AC 183 ms
87,176 KB
testcase_17 AC 186 ms
87,212 KB
testcase_18 AC 195 ms
87,288 KB
testcase_19 AC 188 ms
86,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#int(input())
#map(int, input().split())
#list(map(int, input().split()))

import sys

x = 0
y = 0
z = 0

# a = list(map(int, input().split()))
# cnt = 0

def ques(x, y, z):
    # global cnt
    print(f"? {x} {y} {z}")
    sys.stdout.flush()
    D = int(input())
    # a = [24, -81, 33, 62, 20]
    # dx = x - a[0]
    # dy = y - a[1]
    # dz = z - a[2]
    # D = (dx**2 + dy**2 + dz**2) * a[3] + a[4]
    # cnt += 1
    return D

min1 = -150
max1 = 150

while max1 - min1 >= 3:
    h1 = min1 + (max1 - min1) // 3
    h2 = max1 - (max1 - min1) // 3
    d1 = ques(h1, y, z)
    d2 = ques(h2, y, z)

    if d1 <= d2:
        max1 = h2
    else:
        min1 = h1
    # print(min1, max1)

ansx = 0
dx = 1 << 32
for i in range(min1, max1+1):
    d = ques(i, y, z)
    if d < dx:
        dx = d
        ansx = i

x = ansx


min1 = -150
max1 = 150

while max1 - min1 >= 3:
    h1 = min1 + (max1 - min1) // 3
    h2 = max1 - (max1 - min1) // 3
    d1 = ques(x, h1, z)
    d2 = ques(x, h2, z)

    if d1 <= d2:
        max1 = h2
    else:
        min1 = h1

ansx = 0
dx = 1 << 32
for i in range(min1, max1+1):
    d = ques(x, i, z)
    if d < dx:
        dx = d
        ansx = i

y = ansx

min1 = -150
max1 = 150

while max1 - min1 >= 3:
    h1 = min1 + (max1 - min1) // 3
    h2 = max1 - (max1 - min1) // 3
    d1 = ques(x, y, h1)
    d2 = ques(x, y, h2)

    if d1 <= d2:
        max1 = h2
    else:
        min1 = h1

ansx = 0
dx = 1 << 32
for i in range(min1, max1+1):
    d = ques(x, y, i)
    if d < dx:
        dx = d
        ansx = i

z = ansx

print(f"! {x} {y} {z}")
# print(cnt)
0