結果

問題 No.3161 Find Presents
ユーザー dokukuma
提出日時 2025-05-23 22:54:28
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,048 bytes
コンパイル時間 495 ms
コンパイル使用メモリ 82,168 KB
実行使用メモリ 87,668 KB
最終ジャッジ日時 2025-05-23 22:54:39
合計ジャッジ時間 11,164 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other TLE * 1 -- * 79
権限があれば一括ダウンロードができます

ソースコード

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
    if len(ans) == N:
        return 0
    print("?" ,xl,xr,yl,yr)
    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
        dfs(xl,xl+dx-1, yl,yl+dy-1)
        dfs(xl,xl+dx-1, yl+dy,yr-1)
        dfs(xl+dx,xr-1, yl,yl+dy-1)
        dfs(xl+dx,xr-1, yl+dy,yr-1)

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