結果

問題 No.3018 目隠し宝探し
コンテスト
ユーザー ntuda
提出日時 2025-11-05 23:18:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 110 ms / 2,000 ms
コード長 570 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 82,788 KB
実行使用メモリ 71,040 KB
平均クエリ数 2.64
最終ジャッジ日時 2025-11-05 23:18:32
合計ジャッジ時間 4,285 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

H, W = map(int, input().split())
if H == 1 and W == 1:
    print("!", 1, 1)
elif H == 1:
    print("?", 1, 1)
    a = int(input())
    print("!", 1, int(round(a**0.5,0)) + 1)
elif W == 1:
    print("?", 1, 1)
    a = int(input())
    print("!", int(round(a**0.5,0)) + 1, 1)
else:
    W1 = W - 1
    print("?", 1, 1)
    d1 = int(input())
    if d1 == 0:
        print("!",1,1)
    else:
        print("?", 1, W)
        d2 = int(input())
        x1 = int(round((d1 - d2 + W1 ** 2) / 2 / W1,0))
        y = int(round((d1 - x1 ** 2)**0.5,0))
        print("!", y+1, x1+1)
0