結果
| 問題 | No.3018 目隠し宝探し | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-01-25 14:54:32 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 842 bytes | 
| コンパイル時間 | 153 ms | 
| コンパイル使用メモリ | 82,916 KB | 
| 実行使用メモリ | 83,524 KB | 
| 平均クエリ数 | 2.64 | 
| 最終ジャッジ日時 | 2025-01-25 23:32:10 | 
| 合計ジャッジ時間 | 4,144 ms | 
| ジャッジサーバーID (参考情報) | judge11 / judge6 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 13 WA * 7 RE * 1 | 
ソースコード
H, W = map(int, input().split())
print(f'? {1} {1}', flush=True)
d = int(input())
possible = []
for i in range(H):
    for j in range(W):
        if i**2 + j**2 == d:
            possible.append((i, j))
if len(possible) == 1:
    ansi, ansj = possible[0]
    print(f'! {ansi+1} {ansj+1}', flush=True)
    exit()
if H < W:
    print(f'? {1} {W}', flush=True)
    d = int(input())
    possible2 = []
    for i, j in possible:
        if i**2 + j**2 == d:
            possible2.append((i, j))
    ansi, ansj = possible[0]
    print(f'! {ansi+1} {ansj+1}', flush=True)
    exit()
else:
    print(f'? {H} {1}', flush=True)
    d = int(input())
    possible2 = []
    for i, j in possible:
        if i**2 + j**2 == d:
            possible2.append((i, j))
    ansi, ansj = possible[0]
    print(f'! {ansi+1} {ansj+1}', flush=True)
    exit()
            
            
            
        