Submission #1348706

#TimeUsernameProblemLanguageResultExecution timeMemory
1348706weedywelonCarnival (CEOI14_carnival)C++20
100 / 100
2 ms412 KiB
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <set>
#include <string>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <map>
#include <chrono>
#include <random>
#include <bitset>
#include <tuple>
#include <cassert>
#define SZ(x) (LL)(x.size())
#define FR(i,a,b) for(LL i=(a);i<(b);++i)
#define FOR(i,n) FR(i,0,n)
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define A first
#define B second
#define mp(a,b) make_pair(a,b)
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef unsigned __int128 U128;
typedef __int128 I128;
typedef std::pair<int,int> PII;
typedef std::pair<LL,LL> PLL;
typedef std::pair<LD,LD> PLD;
using namespace std;

//independent set -> size c
//n^2 -> test if everything the same lol
//n -> find everything thats the same as 1

//1,2,...,n
//store the ones that are diff from everything else, vector p
//query i with everything in p (so far)
// if =SZ(p)+1, push i to p
// else, bsearch within p

//time complexity: c+(150-c)*logc. shld work lol

const LL MAXN=155;
vector<LL> p;
LL ans[MAXN];

LL bs(LL i, vector<LL> v){
	if (SZ(v)==1) return v[0];
	
	LL mid=SZ(v)/2;
	vector<LL> t;
	FOR(j,mid) t.push_back(v[j]);
	
	cout<<SZ(t)+1<<" ";
	for (LL x:t) cout<<x<<" ";
	cout<<i<<endl;
	
	LL a; cin>>a;
	if (a==SZ(t)) return bs(i,t);
	vector<LL> t2;
	FR(j,mid,SZ(v)) t2.push_back(v[j]);
	return bs(i,t2);
}

signed main(){
	LL n; cin>>n;
	
	LL id=1;
	ans[1]=1;
	p.push_back(1);
	
	FR(i,2,n+1){
		cout<<SZ(p)+1<<" ";
		for (LL x:p) cout<<x<<" ";
		cout<<i<<endl;
		
		LL a; cin>>a;
		if (a==SZ(p)+1){
			id++;
			ans[i]=id;
			p.push_back(i);
		}
		else{
			LL par=bs(i,p);
			ans[i]=ans[par];
		}
	}
	
	cout<<0<<" ";
	FR(i,1,n+1) cout<<ans[i]<<" ";
	cout<<endl;
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...