Submission #226759

# Submission time Handle Problem Language Result Execution time Memory
226759 2020-04-25T08:43:51 Z jiahng Carnival (CEOI14_carnival) C++14
0 / 100
10 ms 384 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
typedef set <int> si;
#define maxn 501

int N,C;
int ans[maxn];
int idx[maxn];

int qry(si st){
	cout<<st.size()<<' ';
	aFOR(i,st) cout<<i<<' ';
	cout<<'\n';
	cout.flush();
	int res;
	cin>>res;
	return res;
}

int main(){
	fast;
	
	cin>>N;
	
	si curset;
	FOR(i,1,N) curset.insert(i);
	C = qry(curset);
	
	FOR(i,1,N){
		curset.erase(i);
		
		if (qry(curset) != C) curset.insert(i);
	}
	
	int cnt = 1;
	aFOR(i,curset){
		ans[i] = cnt;
		idx[cnt] = i;
		cnt++;
	}
	
	FOR(i,1,N){
		if (curset.find(i) != curset.end()) continue;

		int l = 1, r = C+1;
		
		while (l+1 < r){
			int mid = (l+r)/2;
			
			//check if inside [l,mid]
			
			si qryset;
			FOR(j,l,mid) qryset.insert(idx[j]);
			qryset.insert(i);
			
			int res = qry(qryset);
			
			if (res == mid - l + 1) r = mid; //Inside
			else l = mid + 1;
		}
		ans[i] = l;
	}
	
	cout<<0<<' ';
	FOR(i,1,N) cout<<ans[i]<<' ';
	cout<<'\n';
	cout.flush();
	
}

# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 6 ms 384 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -