結果
| 問題 |
No.3161 Find Presents
|
| コンテスト | |
| ユーザー |
dokukuma
|
| 提出日時 | 2025-05-23 23:20:13 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 350 ms / 4,000 ms |
| コード長 | 1,478 bytes |
| コンパイル時間 | 857 ms |
| コンパイル使用メモリ | 82,156 KB |
| 実行使用メモリ | 95,232 KB |
| 平均クエリ数 | 3352.21 |
| 最終ジャッジ日時 | 2025-05-23 23:20:37 |
| 合計ジャッジ時間 | 22,938 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 80 |
ソースコード
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.add((xl,yl))
return 0
"""
dx = (xr-xl+1)//2
dy = (yr-yl+1)//2
if dx > 0:
if dy > 0:
dfs(xl,xl+dx-1, yl,yl+dy-1)
dfs(xl,xl+dx-1, yl+dy,yr)
if dy > 0:
dfs(xl+dx,xr, yl,yl+dy-1)
dfs(xl+dx,xr, yl+dy,yr)
"""
mx = (xl + xr) // 2
my = (yl + yr) // 2
if xl <= mx and yl <= my:
dfs(xl, mx, yl, my)
if xl <= mx and my + 1 <= yr:
dfs(xl, mx, my + 1, yr)
if mx + 1 <= xr and yl <= my:
dfs(mx + 1, xr, yl, my)
if mx + 1 <= xr and my + 1 <= yr:
dfs(mx + 1, xr, my + 1, yr)
ans = set()
dfs(0,10**6, 0,10**6)
print("!", len(ans))
for i in range(len(ans)):
print(*ans.pop())
dokukuma