結果

問題 No.3018 目隠し宝探し
コンテスト
ユーザー みねしみねみね
提出日時 2025-08-12 21:36:04
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 394 ms / 2,000 ms
+ 999µs
コード長 463 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 52 ms
コンパイル使用メモリ 14,720 KB
実行使用メモリ 10,368 KB
平均クエリ数 2.65
最終ジャッジ日時 2026-11-01 00:53:00
合計ジャッジ時間 4,404 ms
ジャッジサーバーID
(参考情報)
judge7_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import math
h,w = map(int,input().split())
if h == w == 1: exit(print('!',1,1))

print('?',1,1)
d1 = int(input())
if h == 1: exit(print('!',1,1+(int)(math.sqrt(d1))))
if w == 1: exit(print('!',1+(int)(math.sqrt(d1)),1))
if d1 == 0: exit(print('!',1,1))

print('?',h,1)
dn = int(input())
if dn == 0: exit(print('!',h,1))

for r in range(h):
  for c in range(w):
    e1, en = r**2 + c**2, (h - 1 - r)**2 + c**2
    if e1 == d1 and en == dn: exit(print('!',r+1,c+1))
0