結果

問題 No.594 壊れた宝物発見機
ユーザー cleantted
提出日時 2017-11-11 00:22:26
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 1,722 bytes
コンパイル時間 349 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 27,752 KB
平均クエリ数 90.10
最終ジャッジ日時 2024-07-16 14:41:26
合計ジャッジ時間 4,469 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
ans = [0,0,0]
ans2 = [-1,-1,-1]
while ans != ans2:
    ans2[:] = ans[:]
    for i in range(3):
        up = 100
        down = -100
        
        if i == 0:
            while up != down:
                print("?", up, ans[1], ans[2])
                sys.stdout.flush()
                d1 = int(input())
                sys.stdout.flush()
                print("?", down, ans[1], ans[2])
                sys.stdout.flush()
                d2 = int(input())
                sys.stdout.flush()
                if d1 < d2:
                    down = (up + down)//2 + 1
                else:
                    up = (up + down)//2
        elif i == 1:
            while up != down:
                print("?", ans[0], up, ans[2])
                sys.stdout.flush()
                d1 = int(input())
                sys.stdout.flush()
                print("?", ans[0], down, ans[2])
                sys.stdout.flush()
                d2 = int(input())
                sys.stdout.flush()
                if d1 < d2:
                    down = (up + down)//2 + 1
                else:
                    up = (up + down)//2 
        elif i == 2:
            while up != down:
                print("?", ans[0], ans[1], up)
                sys.stdout.flush()
                d1 = int(input())
                sys.stdout.flush()
                print("?", ans[0], ans[1], down)
                sys.stdout.flush()
                d2 = int(input())
                sys.stdout.flush()
                if d1 < d2:
                    down = (up + down)//2 + 1
                else:
                    up = (up + down)//2
                    
        ans[i] = up


print("!", ans[0], ans[1], ans[2])
sys.stdout.flush()
0