답안 #44414

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
44414 2018-04-02T04:25:39 Z MatheusLealV 사육제 (CEOI14_carnival) C++17
100 / 100
26 ms 588 KB
#include <bits/stdc++.h>
#define N 200
#define MAX_SQRT 20
using namespace std;
 
int cor[N], n, raiz, used[N], pai[N], peso[N], comprimir[N], cnt;
 
vector< int > v [20];
 
int query(vector<int> v)
{
	if(v.size() == 0) return 0;
 
	cout<<v.size()<<" ";
 
	for(auto x: v) cout<<x<<" ";
 
	cout<<endl;
 
	int k;
 
	cin>>k;
 
	return k;
}

int get(int ini, int fim)
{
	if(fim < ini) swap(ini, fim);

	vector<int> vv;

	for(int i = ini; i <= fim; i++) vv.push_back(i);

	return query(vv);
}
 
int main()
{
	cin>>n;
 
	raiz = ceil(sqrt(n));

	//for(int i = 1; i <= n; i++) cin>>cor[i];

	for(int i = 1; i < n; i ++)
	{
		if(!pai[i]) pai[i] = ++cnt;

		if( get(i, n) == get(i + 1, n))
		{
			int ini = i + 1, fim = n, mid, best = i;

			while(fim >= ini)
			{
				mid = (ini + fim)/2;

				if( get(i, mid) == get(i + 1, mid))
				{
					best = mid;

					fim = mid - 1;
				}

				else ini = mid + 1;
			}

			pai[best] = pai[i];
		}
	}

	if(!pai[n]) pai[n] = ++cnt;

	cout<<"0 ";

	for(int p = 1; p <= n; p++) cout<<pai[p]<<" ";

	cout<<endl;
 }
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 248 KB Output is correct
2 Correct 20 ms 308 KB Output is correct
3 Correct 12 ms 384 KB Output is correct
4 Correct 7 ms 420 KB Output is correct
5 Correct 12 ms 468 KB Output is correct
6 Correct 17 ms 468 KB Output is correct
7 Correct 18 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 468 KB Output is correct
2 Correct 23 ms 480 KB Output is correct
3 Correct 6 ms 488 KB Output is correct
4 Correct 8 ms 496 KB Output is correct
5 Correct 12 ms 508 KB Output is correct
6 Correct 17 ms 524 KB Output is correct
7 Correct 18 ms 524 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 524 KB Output is correct
2 Correct 19 ms 524 KB Output is correct
3 Correct 19 ms 524 KB Output is correct
4 Correct 7 ms 568 KB Output is correct
5 Correct 17 ms 568 KB Output is correct
6 Correct 21 ms 568 KB Output is correct
7 Correct 21 ms 572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 572 KB Output is correct
2 Correct 22 ms 572 KB Output is correct
3 Correct 11 ms 572 KB Output is correct
4 Correct 6 ms 572 KB Output is correct
5 Correct 12 ms 572 KB Output is correct
6 Correct 13 ms 572 KB Output is correct
7 Correct 26 ms 588 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 588 KB Output is correct
2 Correct 21 ms 588 KB Output is correct
3 Correct 14 ms 588 KB Output is correct
4 Correct 13 ms 588 KB Output is correct
5 Correct 12 ms 588 KB Output is correct
6 Correct 10 ms 588 KB Output is correct
7 Correct 8 ms 588 KB Output is correct