結果
問題 |
No.3018 目隠し宝探し
|
ユーザー |
|
提出日時 | 2025-01-25 14:55:44 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,124 bytes |
コンパイル時間 | 173 ms |
コンパイル使用メモリ | 82,164 KB |
実行使用メモリ | 83,248 KB |
平均クエリ数 | 2.64 |
最終ジャッジ日時 | 2025-01-25 23:32:22 |
合計ジャッジ時間 | 4,254 ms |
ジャッジサーバーID (参考情報) |
judge10 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 20 RE * 1 |
ソースコード
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]) if h == 1 and w == 1: print('!', 1, 1) print('?', 1, 1) d = int(input()) if d == -1: exit() cdds = [] for i in range(1, h+1): for j in range(1, w+1): if (i-1)**2 + (j-1)**2 == d: cdds.append((i, j)) # debug(cdds) if len(cdds) == 1: print('!', *cdds[0]) else: ai, aj = cdds[0] print('?', ai, aj) d = int(input()) if d == -1: exit() for i, j in cdds: if (i-ai)**2 + (j-aj)**2 == d: print('!', i, j) exit() print(-1) input() exit()