답안 #245667

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
245667 2020-07-07T05:37:01 Z hohohaha 사육제 (CEOI14_carnival) C++14
100 / 100
20 ms 504 KB
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vii vector<pair<int, int> >
#define fi first
#define se second
int diff[155][155];
int col[155];
int rep, n;
void ask(int l, int r, int add)
{
	cout<<r-l+2<<" ";
	for(int i=l; i<=r; i++)
	{
		cout<<i<<" ";
	}
	cout<<add<<"\n";
	fflush(stdout);
	cin>>rep;
}
void ans()
{
	cout<<0<<" ";
	for(int i=1; i<=n; i++) cout<<col[i]<<' ';
	cout<<endl;
	fflush(stdout);
}
signed main()
{
	int cnt=0;
	cin>>n;
	for(int i=1; i<=n; i++)
	{
		if(i==1)
		{
			diff[1][1]=1;
			col[1]=++cnt;
		}
		else 
		{
			int ll = 1, rr = i-1;
			while(ll<rr)
			{
				int mid = (ll+rr)/2;
				ask(ll, mid, i);
				if(rep==diff[ll][mid]) rr = mid;
				else ll=mid+1;
			}
			ask(ll,ll, i);
			if(rep==diff[ll][ll]) col[i]=col[ll];
			else col[i]=++cnt;
			set<int> s;
			for(int j=i; j>=1; j--)
			{
				s.insert(col[j]);
				diff[j][i]=s.size();
			}
		}
	}
	ans();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 384 KB Output is correct
2 Correct 13 ms 384 KB Output is correct
3 Correct 14 ms 384 KB Output is correct
4 Correct 14 ms 384 KB Output is correct
5 Correct 18 ms 384 KB Output is correct
6 Correct 10 ms 380 KB Output is correct
7 Correct 18 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 408 KB Output is correct
2 Correct 18 ms 384 KB Output is correct
3 Correct 11 ms 384 KB Output is correct
4 Correct 17 ms 384 KB Output is correct
5 Correct 18 ms 384 KB Output is correct
6 Correct 18 ms 384 KB Output is correct
7 Correct 20 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 384 KB Output is correct
2 Correct 15 ms 384 KB Output is correct
3 Correct 19 ms 504 KB Output is correct
4 Correct 14 ms 384 KB Output is correct
5 Correct 15 ms 384 KB Output is correct
6 Correct 14 ms 384 KB Output is correct
7 Correct 15 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 384 KB Output is correct
2 Correct 13 ms 384 KB Output is correct
3 Correct 16 ms 384 KB Output is correct
4 Correct 19 ms 384 KB Output is correct
5 Correct 16 ms 384 KB Output is correct
6 Correct 15 ms 384 KB Output is correct
7 Correct 19 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 384 KB Output is correct
2 Correct 15 ms 444 KB Output is correct
3 Correct 15 ms 384 KB Output is correct
4 Correct 19 ms 384 KB Output is correct
5 Correct 19 ms 504 KB Output is correct
6 Correct 14 ms 444 KB Output is correct
7 Correct 17 ms 384 KB Output is correct