結果

問題 No.3161 Find Presents
ユーザー ゼット
提出日時 2025-05-23 19:56:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 341 ms / 4,000 ms
コード長 795 bytes
コンパイル時間 365 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 95,052 KB
平均クエリ数 2100.98
最終ジャッジ日時 2025-05-23 19:56:23
合計ジャッジ時間 21,872 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 80
権限があれば一括ダウンロードができます

ソースコード

diff #

h=[]
result=[]
pos=1
while pos<=10**6:
  print('?',pos,10**6,1,10**6,flush=True)
  ans=int(input())
  if ans==0:
    break
  l=pos
  r=10**6
  while True:
    if l==r:
      break
    m=(l+r)//2
    print('?',pos,m,1,10**6,flush=True)
    ans=int(input())
    if ans==True:
      r=m
    else:
      l=m+1
  h.append(l)
  pos=l+1
for x in h:
  pos=1
  while pos<=10**6:
    print('?',x,x,pos,10**6,flush=True)
    ans=int(input())
    if ans==0:
      break
    l=pos
    r=10**6
    while True:
      if l==r:
        break
      m=(l+r)//2
      print('?',x,x,pos,m,flush=True)
      ans=int(input())
      if ans==True:
        r=m
      else:
        l=m+1
    result.append((x,l))
    pos=l+1
print('!',len(result),flush=True)
for i in range(len(result)):
  print(result[i][0],result[i][1])
0