Submission #99367

# Submission time Handle Problem Language Result Execution time Memory
99367 2019-03-03T04:09:40 Z nad312 Carnival (CEOI14_carnival) C++17
0 / 100
10 ms 512 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;
		}
	}
	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;
	fflush(stdout);
}
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 348 KB Output is correct
2 Incorrect 7 ms 512 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 328 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 256 KB Output is correct
2 Incorrect 10 ms 384 KB Incorrect
3 Halted 0 ms 0 KB -