結果

問題 No.3018 目隠し宝探し
コンテスト
ユーザー 👑 loop0919
提出日時 2025-01-01 03:08:17
言語 PyPy3
(8.0.1 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 208 ms / 2,000 ms
+ 999µs
コード長 544 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 146 ms
コンパイル使用メモリ 64,352 KB
実行使用メモリ 58,276 KB
平均クエリ数 2.70
最終ジャッジ日時 2026-10-31 23:58:57
合計ジャッジ時間 4,078 ms
ジャッジサーバーID
(参考情報)
judge7_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from math import isqrt
H, W = map(int, input().split())

if H == 1 and W == 1:
    print("!", 1, 1)
    exit()

if H == 1:
    print("?", 1, 1)
    d = int(input())
    print("!", 1, isqrt(d) + 1)
    exit()

if W == 1:
    print("?", 1, 1)
    d = int(input())
    print("!", isqrt(d) + 1, 1)
    exit()

print("?", 1, 1)
d_1 = int(input())

print("?", 1, W)
d_2 = int(input())

for i in range(H):
    for j in range(W):
        if i**2 + j**2 == d_1 and i**2 + ((W - 1) - j)**2 == d_2:
            print("!", i + 1, j + 1)
            exit()
0