Submission #99366

# Submission time Handle Problem Language Result Execution time Memory
99366 2019-03-03T04:08:14 Z nad312 Carnival (CEOI14_carnival) C++17
0 / 100
11 ms 384 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
const lli N=200;
lli n, a[N], col[N], st[N], cnt=0;
deque<lli> query, p;
lli Ask()
{
	cout<<query.size()<<" ";
	for(auto v: query)
	{
		cout<<v<<" ";
	}
	cout<<endl;
	fflush(stdout);
	lli k;
	cin>>k;
	return k;
}
void Find(lli x)
{
	lli l=0, h=p.size()-1;
	while(l<h)
	{
		lli mid=(l+h)/2;
		query.clear();
		query.push_back(x);
		for(int i=l;i<=mid;i++)
		{
			query.push_back(p[i]);
		}
		if(Ask()>a[p[mid]])
		{
			l=mid+1;
		}
		else
		{
			h=mid;
		}
	}
	col[x]=col[p[l]];
}
int main()
{
	fill_n(&col[0], sizeof(col)/sizeof(col[0]), -1);
	fill_n(&a[0], sizeof(a)/sizeof(a[0]), -1);
	cin>>n;
	a[0]=0;
	for(int i=1;i<=n;i++)
	{
		query.push_back(i);
		a[i]=Ask();
		if(a[i]>a[i-1])
		{
			cnt++;
			col[i]=cnt;
			st[cnt]=i;
		}
	}
	for(int i=1;i<=n;i++)
	{
		if(col[i]==-1)
		{
			Find(i);
		}
		else
		{
			p.push_back(i);
		}
	}
	cout<<0<<" ";
	for(int i=1;i<=n;i++)
	{
		cout<<col[i]<<" ";
	}
	cout<<endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 300 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 6 ms 332 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 256 KB Output is correct
2 Incorrect 11 ms 256 KB Incorrect
3 Halted 0 ms 0 KB -