結果

問題 No.3161 Find Presents
ユーザー dokukuma
提出日時 2025-05-23 23:00:28
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,120 bytes
コンパイル時間 623 ms
コンパイル使用メモリ 82,300 KB
実行使用メモリ 95,484 KB
平均クエリ数 2919.41
最終ジャッジ日時 2025-05-23 23:00:52
合計ジャッジ時間 22,144 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 WA * 78
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, time, random, heapq, math, itertools
from collections import deque, Counter, defaultdict
#from sortedcontainers import SortedSet, SortedList
from bisect import bisect, bisect_left, bisect_right
import heapq as hq
from functools import cache, cmp_to_key
def debug(*x):print('debug:',*x, file=sys.stderr)
sys.setrecursionlimit(300000)
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 61 - 1
mod = 998244353

def dfs(xl,xr,yl,yr):
    global ans
    
    print("?" ,xl,xr,yl,yr, flush=True )
    q = ii()
    if q == 0:
        return 0
    else:
        if xl == xr and yl == yr:
            ans.append([xl,yl])
            return 0
        dx = (xr-xl)//2
        dy = (yr-yl)//2
        if dx > 0:
            if dy > 0:
                dfs(xl,xl+dx-1, yl,yl+dy-1)
            dfs(xl,xl+dx-1, yl+dy,yr-1)
        if dy > 0:
            dfs(xl+dx,xr-1, yl,yl+dy-1)
            
        dfs(xl+dx,xr-1, yl+dy,yr-1)

ans = []
dfs(0,10**6, 0,10**6)
print("!", len(ans))
for i in range(len(ans)):
    print(*ans[i])
0