Submission #99365

# Submission time Handle Problem Language Result Execution time Memory
99365 2019-03-03T04:04:32 Z nad312 Carnival (CEOI14_carnival) C++17
0 / 100
12 ms 420 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;
	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 7 ms 420 KB Incorrect
2 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 6 ms 384 KB Output is correct
2 Incorrect 9 ms 376 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 6 ms 324 KB Output is correct
2 Incorrect 12 ms 256 KB Incorrect
3 Halted 0 ms 0 KB -