답안 #99369

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
99369 2019-03-03T04:23:37 Z nad312 사육제 (CEOI14_carnival) C++17
100 / 100
10 ms 416 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()>mid-l+1)
		{
			l=mid+1;
		}
		else
		{
			h=mid;
		}
	}
	col[x]=col[p[l]];
}
int main()
{
	fill_n(&col[0], sizeof(col)/sizeof(col[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);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 256 KB Output is correct
2 Correct 9 ms 256 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 4 ms 412 KB Output is correct
6 Correct 6 ms 256 KB Output is correct
7 Correct 7 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 256 KB Output is correct
2 Correct 5 ms 416 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 396 KB Output is correct
6 Correct 7 ms 384 KB Output is correct
7 Correct 7 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 332 KB Output is correct
3 Correct 8 ms 256 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 8 ms 384 KB Output is correct
6 Correct 7 ms 256 KB Output is correct
7 Correct 9 ms 412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 384 KB Output is correct
2 Correct 6 ms 256 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 3 ms 416 KB Output is correct
5 Correct 8 ms 256 KB Output is correct
6 Correct 6 ms 256 KB Output is correct
7 Correct 8 ms 328 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 336 KB Output is correct
2 Correct 10 ms 256 KB Output is correct
3 Correct 5 ms 336 KB Output is correct
4 Correct 9 ms 256 KB Output is correct
5 Correct 6 ms 384 KB Output is correct
6 Correct 5 ms 328 KB Output is correct
7 Correct 6 ms 384 KB Output is correct