結果
| 問題 | No.3018 目隠し宝探し |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-01-25 15:06:18 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 268 ms / 2,000 ms |
| + 999µs | |
| コード長 | 934 bytes |
| 記録 | |
| コンパイル時間 | 84 ms |
| コンパイル使用メモリ | 64,384 KB |
| 実行使用メモリ | 58,420 KB |
| 平均クエリ数 | 2.61 |
| 最終ジャッジ日時 | 2026-11-01 00:03:50 |
| 合計ジャッジ時間 | 3,853 ms |
|
ジャッジサーバーID (参考情報) |
judge7_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 22 |
ソースコード
H, W = map(int, input().split())
if (H, W) == (1,1):
print(f'! {1} {1}', flush=True)
exit()
print(f'? {1} {1}', flush=True)
d = int(input())
possible = []
for i in range(1, H+1):
for j in range(1, W+1):
if (i-1)**2 + (j-1)**2 == d:
possible.append((i, j))
if len(possible) == 1:
ansi, ansj = possible[0]
print(f'! {ansi} {ansj}', flush=True)
exit()
if H < W:
print(f'? {1} {W}', flush=True)
d = int(input())
possible2 = []
for i, j in possible:
if (i-1)**2 + (W-j)**2 == d:
possible2.append((i, j))
ansi, ansj = possible2[0]
print(f'! {ansi} {ansj}', flush=True)
exit()
else:
print(f'? {H} {1}', flush=True)
d = int(input())
possible2 = []
for i, j in possible:
if (H-i)**2 + (j-1)**2 == d:
possible2.append((i, j))
ansi, ansj = possible2[0]
print(f'! {ansi} {ansj}', flush=True)
exit()