結果

問題 No.594 壊れた宝物発見機
ユーザー GrayCoderGrayCoder
提出日時 2018-07-29 20:43:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 1,073 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 11,032 KB
実行使用メモリ 24,536 KB
平均クエリ数 72.90
最終ジャッジ日時 2023-09-23 16:11:59
合計ジャッジ時間 3,757 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
23,688 KB
testcase_01 AC 117 ms
23,588 KB
testcase_02 AC 116 ms
24,036 KB
testcase_03 AC 114 ms
23,384 KB
testcase_04 AC 113 ms
24,168 KB
testcase_05 AC 112 ms
24,536 KB
testcase_06 AC 114 ms
24,336 KB
testcase_07 AC 114 ms
24,264 KB
testcase_08 AC 119 ms
23,380 KB
testcase_09 AC 117 ms
23,352 KB
testcase_10 AC 113 ms
24,188 KB
testcase_11 AC 112 ms
23,628 KB
testcase_12 AC 114 ms
24,356 KB
testcase_13 AC 115 ms
24,244 KB
testcase_14 AC 116 ms
24,036 KB
testcase_15 AC 118 ms
24,036 KB
testcase_16 AC 119 ms
24,292 KB
testcase_17 AC 116 ms
23,868 KB
testcase_18 AC 115 ms
24,264 KB
testcase_19 AC 116 ms
23,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin, stdout
input = lambda: stdin.readline().rstrip()
write = stdout.write

def main():
    x = y = z = 0
    for s in ('x', 'y', 'z'):
        d = dist(s, x, y, z)
        if s == 'x':
            x = d
        elif s == 'y':
            y = d
        else:
            z = d
    print('!', x, y, z)
    stdout.flush()

def dist(axis, x, y, z):
    point = -100
    max_ = 150
    dmin = float('inf')
    while point < max_:
        xi = point if axis == 'x' else x
        yi = point if axis == 'y' else y
        zi = point if axis == 'z' else z
        print('?', xi, yi, zi)
        stdout.flush()
        d = int(input())
        if d > dmin:
            break
        dmin = d
        point += 10
    dmin = d

    while 1:
        point -= 1
        xi = point if axis == 'x' else x
        yi = point if axis == 'y' else y
        zi = point if axis == 'z' else z
        print('?', xi, yi, zi)
        stdout.flush()
        d = int(input())
        if d < dmin:
            dmin = d
        else:
            break
    return point + 1

main()
0