結果
| 問題 | No.3018 目隠し宝探し |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-02-05 16:11:29 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 125 ms / 2,000 ms |
| コード長 | 623 bytes |
| 記録 | |
| コンパイル時間 | 313 ms |
| コンパイル使用メモリ | 85,248 KB |
| 実行使用メモリ | 72,664 KB |
| 平均クエリ数 | 2.59 |
| 最終ジャッジ日時 | 2026-06-27 09:26:53 |
| 合計ジャッジ時間 | 5,169 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 21 |
ソースコード
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()