結果

問題 No.3018 目隠し宝探し
ユーザー D M
提出日時 2025-02-05 16:11:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 157 ms / 2,000 ms
コード長 623 bytes
コンパイル時間 529 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 70,272 KB
平均クエリ数 2.59
最終ジャッジ日時 2025-02-05 16:11:36
合計ジャッジ時間 5,729 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

H=[]
cnt=0
while cnt**2<=10**6:
    H.append(cnt**2)
    cnt+=1
h,w=map(int,input().split())
if h*w==1:
    print("!",1,1)
    exit()
print("?",1,1)
d1=int(input())
stc=[]
for i,j in enumerate(H):
    if d1-j in H:
        if 1<=i+1<=h and 1<=H.index(d1-j)+1<=w:
            stc.append((i+1,H.index(d1-j)+1))
if len(stc)==1:
    print("!",stc[0][0],stc[0][1])
    exit()
print("?",h,1)
d2=int(input())
stc1=[]
for i,j in enumerate(H):
    if d2-j in H:
        if 1<=h-i<=h and 1<=H.index(d2-j)+1<=w:
            stc1.append((h-i,H.index(d2-j)+1))
for a,b in stc1:
    if (a,b) in stc:
        print("!",a,b)
        exit()
0