結果

問題 No.3018 目隠し宝探し
コンテスト
ユーザー ntuda
提出日時 2025-11-05 23:18:28
言語 PyPy3
(8.0.1 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 315 ms / 2,000 ms
+ 999µs
コード長 570 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 83 ms
コンパイル使用メモリ 64,564 KB
実行使用メモリ 53,848 KB
平均クエリ数 2.65
最終ジャッジ日時 2026-11-01 01:21:52
合計ジャッジ時間 3,990 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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