結果
問題 | No.3018 目隠し宝探し |
ユーザー |
|
提出日時 | 2025-01-25 13:50:53 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 227 ms / 2,000 ms |
コード長 | 1,375 bytes |
コンパイル時間 | 250 ms |
コンパイル使用メモリ | 82,588 KB |
実行使用メモリ | 107,672 KB |
平均クエリ数 | 2.68 |
最終ジャッジ日時 | 2025-01-25 23:00:34 |
合計ジャッジ時間 | 6,827 ms |
ジャッジサーバーID (参考情報) |
judge10 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 21 |
ソースコード
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('?',1,2,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-1)**2 + (j-2)**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)