結果

問題 No.3018 目隠し宝探し
ユーザー kmmtkm
提出日時 2025-01-25 14:32:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 548 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 82,676 KB
実行使用メモリ 154,468 KB
平均クエリ数 2.23
最終ジャッジ日時 2025-01-25 23:22:51
合計ジャッジ時間 5,108 ms
ジャッジサーバーID
(参考情報)
judge6 / judge7
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 10 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys


def debug(*args):
    print(*args, file=sys.stderr)


h, w = map(int, input().split())
cdds = [(i, j) for i in range(1, h+1) for j in range(1, h+1)]

asks = [(1, h), (h, w), (1, 1)]
while len(cdds) > 1 and asks:
    new_cdds = []
    ai, aj = asks.pop()
    print('?', ai, aj)
    d = int(input())
    if d == -1:
        exit()
    for i, j in cdds:
        if (i-ai) ** 2 + (j-aj) ** 2 == d:
            new_cdds.append((i, j))

    cdds, new_cdds = new_cdds, cdds
    # debug('d', cdds)
if not cdds:
    exit()
print('!', *cdds[0])
0