結果

問題 No.3018 目隠し宝探し
ユーザー hato336
提出日時 2025-01-25 13:46:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,375 bytes
コンパイル時間 615 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 107,120 KB
平均クエリ数 2.68
最終ジャッジ日時 2025-01-25 22:58:36
合計ジャッジ時間 6,002 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 18 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
#sys.set_int_max_str_digits(0)
#input = sys.stdin.readline
#n = int(input())
#alist = list(map(int,input().split()))
#alist = []
#s = input()
h,w = map(int,input().split())
if h == 1 and w == 1:
print('!',1,1,flush=True)
exit()
if h == 1:
print('?',1,1,flush=True)
d = int(input())
for y in range(1,w+1):
if (1-y)**2 == d:
print('!',1,y)
exit()
if w == 1:
print('?',1,1,flush=True)
d = int(input())
for y in range(1,h+1):
if (1-y)**2 == d:
print('!',y,1)
exit()
print('?',1,1,flush=True)
d1 = int(input())
print('?',h,w,flush=True)
d2 = int(input())
for i in range(1,h+1):
for j in range(1,w+1):
if (i-1)**2 + (j-1)**2 == d1 and (i-h)**2 + (j-w)**2 == d2:
exit(print('!',i,j,flush=True))
exit()
#for i in range(n):
# alist.append(list(map(int,input().split())))
print('?',1,1,flush=True)
d1 = int(input())
print('?',1,w,flush=True)
d2 = int(input())
y = -1
for i in range(1,w+1):
if (1 - i)**2 - (w - i)**2 == d1 - d2:
y = i
break
print('?',h,1,flush=True)
d3 = int(input())
x = -1
for i in range(1,h+1):
if (1 - i)**2 - (h - i)**2 == d1 - d3:
x = i
break
print('!',x,y,flush=True)
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0