QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#86841#4218. Hidden GraphCharlieVinnieRE 0ms0kbC++141.0kb2023-03-11 10:54:552023-03-11 10:54:59

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-11 10:54:59]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2023-03-11 10:54:55]
  • 提交

answer

#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Rev(i,a,b) for(int i=a;i>=b;i--)
#define Fin(file) freopen(file,"r",stdin)
#define Fout(file) freopen(file,"w",stdout)
using namespace std; using ll = long long;
const int N=2e3+5; using pii = pair<int,int>;
int n,col[N],vis[N]; vector<pii> ans; vector<int> lis[N];
pii query(const vector<int>& vec){
	cout<<"? "<<vec.size()<<' '; for(int x:vec) cout<<x<<' ';; cout<<'\n';
	int x,y; cin>>x>>y; return pii(x,y);
}
int main(){
	cin>>n; col[1]=1;
	For(u,2,n){
		For(i,1,n) lis[i].clear(),vis[i]=0;
		For(v,1,u-1) lis[col[v]].push_back(v);
		For(i,1,n) if(lis[i].size()){
			vector<int> tmp=lis[i]; tmp.push_back(u);
			while(true){
				auto pr=query(tmp);
				if(pr.first==-1) break;
				assert(pr.first==u||pr.second==u);
				int v=pr.first^pr.second^u;
				vis[col[v]]=1; ans.push_back(minmax(u,v));
			}
		}
		For(i,1,n) if(!vis[i]) { col[u]=i; break; }
	}
	cout<<"! "<<ans.size()<<'\n';
	for(auto pr:ans) cout<<pr.first<<' '<<pr.second<<'\n';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Dangerous Syscalls

input:

3
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2

output:

? 2 1 2 
? 2 1 2 
? 2 1 2 
? 2 1 2 
? 2 1 2 
? 2 1 2 
? 2 1 2 
? 2 1 2 
? 2 1 2 
? 2 1 2 
? 2 1 2 
? 2 1 2 
? 2 1 2 
? 2 1 2 
? 2 1 2 
? 2 1 2 
? 2 1 2 

result: