| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 83827 | aminra | Carnival (CEOI14_carnival) | C++14 | 10 ms | 696 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double ld;
const int MAXN = (int)1e5 + 7;
const int infint = (int)1e9;
const int MOD = (int)1e9 + 9;
const ll inf = (ll)2e18 + 2;
int n, a[MAXN], tsz = 1;
int ask(vector<int> v)
{
	cout << v.size() << " ";
	for (auto u : v)
		cout << u << " ";
	cout << endl;
	int get;
	cin >> get;
	return get;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> n;
	a[1] = tsz;
	vector<int> nws;
	nws.push_back(1);
	for (int i = 2; i <= n; i++)
	{
		nws.push_back(i);
		int t = ask(nws);
		if(t == nws.size())
		{
			a[i] = ++tsz;
			continue;
		}
		else
		{
			nws.pop_back();
			int L = -1, R = nws.size() - 1;
			while(R - L > 1)
			{
				int mid = (R + L) >> 1;
				vector<int> tmp;
				for (int i = 0; i <= mid; i++)
					tmp.push_back(nws[i]);
				tmp.push_back(i);
				int t = ask(tmp);
				if(t == tmp.size() - 1)
					R = mid;
				else
					L = mid;
			}
			a[i] = a[nws[R]];
		}
	}
	cout << 0 << " ";
	for (int i = 1; i <= n; i++)
		cout << a[i] << " ";
	cout << endl;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
