Submission #100931

# Submission time Handle Problem Language Result Execution time Memory
100931 2019-03-15T10:00:10 Z square1001 Carnival (CEOI14_carnival) C++14
100 / 100
39 ms 384 KB
#include <vector>
#include <iostream>
using namespace std;
int ask(int L, int R) {
	cout << R - L;
	for (int i = L; i < R; ++i) {
		cout << ' ' << i + 1;
	}
	cout << endl;
	int x;
	cin >> x;
	return x;
}
int main() {
	int N;
	cin >> N;
	vector<int> C(N);
	int cnt = 0;
	for (int i = N - 1; i >= 0; --i) {
		int L = i + 1, R = N + 1;
		while (R - L > 1) {
			int M = (L + R) >> 1;
			int r1 = ask(i, M);
			int r2 = ask(i + 1, M);
			if (r1 != r2) L = M;
			else R = M;
		}
		if (R != N + 1) C[i] = C[R - 1];
		else C[i] = ++cnt;
	}
	cout << 0;
	for (int i = 0; i < N; ++i) {
		cout << ' ' << C[i];
	}
	cout << endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 22 ms 304 KB Output is correct
2 Correct 21 ms 256 KB Output is correct
3 Correct 29 ms 384 KB Output is correct
4 Correct 30 ms 256 KB Output is correct
5 Correct 19 ms 384 KB Output is correct
6 Correct 17 ms 256 KB Output is correct
7 Correct 23 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 256 KB Output is correct
2 Correct 20 ms 256 KB Output is correct
3 Correct 15 ms 256 KB Output is correct
4 Correct 20 ms 384 KB Output is correct
5 Correct 18 ms 256 KB Output is correct
6 Correct 20 ms 256 KB Output is correct
7 Correct 11 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 384 KB Output is correct
2 Correct 9 ms 256 KB Output is correct
3 Correct 29 ms 384 KB Output is correct
4 Correct 22 ms 256 KB Output is correct
5 Correct 22 ms 256 KB Output is correct
6 Correct 19 ms 384 KB Output is correct
7 Correct 23 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 256 KB Output is correct
2 Correct 15 ms 304 KB Output is correct
3 Correct 26 ms 256 KB Output is correct
4 Correct 39 ms 256 KB Output is correct
5 Correct 20 ms 384 KB Output is correct
6 Correct 29 ms 384 KB Output is correct
7 Correct 12 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 256 KB Output is correct
2 Correct 24 ms 384 KB Output is correct
3 Correct 18 ms 256 KB Output is correct
4 Correct 20 ms 256 KB Output is correct
5 Correct 23 ms 384 KB Output is correct
6 Correct 19 ms 256 KB Output is correct
7 Correct 19 ms 256 KB Output is correct