結果
| 問題 | No.3161 Find Presents | 
| コンテスト | |
| ユーザー |  沙耶花 | 
| 提出日時 | 2025-05-23 20:14:36 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 200 ms / 4,000 ms | 
| コード長 | 1,039 bytes | 
| コンパイル時間 | 3,818 ms | 
| コンパイル使用メモリ | 253,116 KB | 
| 実行使用メモリ | 25,960 KB | 
| 平均クエリ数 | 2601.07 | 
| 最終ジャッジ日時 | 2025-05-23 20:14:53 | 
| 合計ジャッジ時間 | 15,931 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 80 | 
ソースコード
#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000005
#define Inf64 4000000000000000001LL
vector<pair<int,int>> ans;
int cc = 0;
int query(int x1,int x2,int y1,int y2){
	cc++;
	cout<<"? "<<x1<<' '<<x2<<' '<<y1<<' '<<y2<<endl;
	int res;
	cin>>res;
	return res;
}
void dfs(int x1,int x2,int y1,int y2){
	if(x1!=x2){
		int m = (x1+x2)/2;
		int res = query(x1,m,y1,y2);
		if(res==0)dfs(m+1,x2,y1,y2);
		else{
			dfs(x1,m,y1,y2);
			res = query(m+1,x2,y1,y2);
			if(res)dfs(m+1,x2,y1,y2);
		}
	}
	else if(y1!=y2){
		int m = (y1+y2)/2;
		int res = query(x1,x2,y1,m);
		if(res==0)dfs(x1,x2,m+1,y2);
		else{
			dfs(x1,x2,y1,m);
			res = query(x1,x2,m+1,y2);
			if(res)dfs(x1,x2,m+1,y2);
		}
	}
	else{
		ans.emplace_back(x1,y1);
	}
}
int main(){
	dfs(0,1000000,0,1000000);
	cout<<"! "<<ans.size()<<endl;
	rep(i,ans.size()){
		cout<<ans[i].first<<' '<<ans[i].second<<endl;
	}
	return 0;
}
            
            
            
        