QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#101973#4218. Hidden GraphEXODUSRE 0ms0kbC++141.1kb2023-05-01 22:57:492023-05-01 22:57:51

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-01 22:57:51]
  • Judged
  • Verdict: RE
  • Time: 0ms
  • Memory: 0kb
  • [2023-05-01 22:57:49]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
#define eb emplace_back
#define Debug(...) fprintf(stderr,__VA_ARGS__)
template<typename T>
void read(T &x){
	scanf("%d",&x);
}
template<typename T,typename... Args>
void read(T &x,Args &...args){read(x),read(args...);}
const int N=2e3+7;
int n,K=0,ban[N];
vector<int>s[N];
vector<pair<int,int> >e;
int main(){
	read(n);
	auto ask=[&](int u,int siz,vector<int>&S){
		printf("? %d ",(int)siz+1);
		printf("%d ",u);
		for(auto v:S)if(ban[v]!=ban[0])printf("%d ",v);
		printf("\n");
		fflush(stdout);
	};
	for(int i=ban[0]=1;i<=n;i++,ban[0]++){
		if(i==1){s[++K].eb(1);continue;}
		else{
			int pos=0,flg=0;
			for(int j=1,p,q;j<=K;j++){
				flg=0;ask(i,s[j].size(),s[j]);read(p,q);
				while(p!=-1){
					if(p==i)swap(p,q);
					ban[p]=ban[0];e.eb(make_pair(p,q));
					flg++;ask(i,s[j].size()-flg,s[j]);read(p,q);
				}
				if(!flg&&!pos)pos=j;
			}
			if(!pos)pos=++K;
			s[pos].eb(i);
		}
		if(K>2)assert(0);
	}
	printf("! %d\n",(int)e.size());
	for(auto [u,v]:e)printf("%d %d\n",u,v);
	fflush(stdout);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Dangerous Syscalls

input:

3
1 2
-1 -1
1 3
-1 -1
2 3
-1 -1

output:

? 2 2 1 
? 1 2 
? 2 3 1 
? 1 3 
? 2 3 2 
? 1 3 

result: