Submission #36885

# Submission time Handle Problem Language Result Execution time Memory
36885 2017-12-17T08:44:42 Z cheater2k Carnival (CEOI14_carnival) C++14
100 / 100
13 ms 2180 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 155;

vector<int> vec[N];
int n, color[N];
int cnt = 1;

int get(vector<int> &a) {
	cout << a.size() << ' ';
	for (int u : a) cout << u << ' ';
	cout << endl;
	int ret; cin >> ret; return ret;
}

bool inside(int l, int r, int cur) {
	vector<int> a;
	for (int c = l; c <= r; ++c) a.push_back(vec[c][0]);
	a.push_back(cur);

	int x = r - l + 1;
	int y = get(a);

	if (x == y) return true; // inside
	else return false;
}

bool ask(int l, int r, int cur) {
	if (l == r) {
		if (inside(l, r, cur)) { vec[l].push_back(cur); return true; }
		else return false;
	}
	int mid = ((l + r) >> 1);

	if (inside(l, mid, cur)) return ask(l, mid, cur);
	else return ask(mid + 1, r, cur);
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n;
	vec[1].push_back(1);

	for (int i = 2; i <= n; ++i) {
		bool done = ask(1, cnt, i);
		if (!done) {
			vec[++cnt].push_back(i);
		}
	}

	for (int i = 1; i <= cnt; ++i) {
		for (int u : vec[i]) color[u] = i;
	}
	// output
	cout << 0 << ' ';
	for (int i = 1; i <= n; ++i) cout << color[i] << ' '; cout << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 2180 KB Output is correct
2 Correct 3 ms 2180 KB Output is correct
3 Correct 3 ms 2180 KB Output is correct
4 Correct 6 ms 2180 KB Output is correct
5 Correct 3 ms 2180 KB Output is correct
6 Correct 3 ms 2180 KB Output is correct
7 Correct 6 ms 2180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 2180 KB Output is correct
2 Correct 9 ms 2180 KB Output is correct
3 Correct 3 ms 2180 KB Output is correct
4 Correct 0 ms 2180 KB Output is correct
5 Correct 3 ms 2180 KB Output is correct
6 Correct 3 ms 2180 KB Output is correct
7 Correct 0 ms 2180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 2180 KB Output is correct
2 Correct 3 ms 2180 KB Output is correct
3 Correct 3 ms 2180 KB Output is correct
4 Correct 6 ms 2180 KB Output is correct
5 Correct 0 ms 2180 KB Output is correct
6 Correct 0 ms 2180 KB Output is correct
7 Correct 0 ms 2180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2180 KB Output is correct
2 Correct 6 ms 2180 KB Output is correct
3 Correct 6 ms 2180 KB Output is correct
4 Correct 13 ms 2180 KB Output is correct
5 Correct 0 ms 2180 KB Output is correct
6 Correct 3 ms 2180 KB Output is correct
7 Correct 3 ms 2180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2180 KB Output is correct
2 Correct 3 ms 2180 KB Output is correct
3 Correct 9 ms 2180 KB Output is correct
4 Correct 0 ms 2180 KB Output is correct
5 Correct 3 ms 2180 KB Output is correct
6 Correct 6 ms 2180 KB Output is correct
7 Correct 3 ms 2180 KB Output is correct