Submission #110507

# Submission time Handle Problem Language Result Execution time Memory
110507 2019-05-11T05:02:22 Z Mahdi_Jfri Carnival (CEOI14_carnival) C++14
0 / 100
16 ms 560 KB
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define pb push_back

const int maxn = 50 + 20;

int c[maxn] , id = 1;

int cnt(int l , int r)
{
	vector<int> tmp;
	for(int i = l; i < r; i++)
		tmp.pb(c[i]);
	sort(tmp.begin() , tmp.end());

	return unique(tmp.begin() , tmp.end()) - tmp.begin();
}

int ask(int l , int r)
{
	cout << r - l + 1 << " ";
	for(int i = l; i <= r; i++)
		cout << i + 1 << " ";
	cout << endl;
	int x;
	cin >> x;
	return x;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin >> n;

	for(int i = 1; i < n; i++)
	{
		int L = 0 , R = i;
		if(ask(0 , i) != cnt(0 , i))
		{
			c[i] = id++;
			continue;
		}

		while(R - L > 1)
		{
			int m = (L + R) / 2;
			if(ask(m , i) != cnt(m , i))
				R = m;
			else
				L = m;
		}

		c[i] = c[L];
	}

	cout << 0 << " ";
	for(int i = 0; i < n; i++)
		cout << c[i] + 1 << " ";
	cout << endl;
}


































# Verdict Execution time Memory Grader output
1 Runtime error 9 ms 544 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 15 ms 424 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 13 ms 560 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 15 ms 460 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 16 ms 464 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -