Submission #350527

# Submission time Handle Problem Language Result Execution time Memory
350527 2021-01-19T06:29:44 Z Bill_00 Carnival (CEOI14_carnival) C++14
0 / 100
1 ms 364 KB
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
#define N 1000000
typedef long long ll;
using namespace std;
int color[N],k=0,p;
vector<int>v;
int interact(int l,int r,int u=0){
	int y=0;
	if(u!=0) y++;
	cout << r-l+1+y << ' ';
	for(int i=l;i<=r;i++){
		cout << i << ' ';
	}
	if(u!=0) cout << u;
	fflush(stdout);
	cin >> p;
	return p;
}
void solve(int l,int m,int r,int t){
	if(l==m){
		int c=interact(l,m);
		int d=interact(l,m,t);
		if(c==d){
			color[t]=color[l];
		}
		else color[t]=color[l+1];
		return;
	}
	int c=interact(l,m);
	int d=interact(l,m,t);
	if(c==d){
		int x=(l+m)>>1;
		solve(l,x,m,t);
	}
	else{
		int x=(m+1+r)>>1;
		solve(m+1,x,r,t);
	}


}
int main(){
	int n;
	cin >> n;
	color[1]=1;
	k++;
	for(int i=2;i<=n;i++){
		int c=interact(1,i-1);
		v.pb(i);
		int d=interact(1,i);
		if(d>c){
			k++;
			color[i]=k;
		}
		else{
			int m=(1+(i-1))>>1;
			solve(1,m,i-1,i);
		}
	}
	cout << 0 << ' ';
	for(int i=1;i<=n;i++){
		cout << color[i] << ' ';
	}
	return 0;

}
# Verdict Execution time Memory Grader output
1 Execution timed out 1 ms 364 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1 ms 364 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1 ms 364 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1 ms 364 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1 ms 364 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -