Submission #257145

# Submission time Handle Problem Language Result Execution time Memory
257145 2020-08-03T16:21:56 Z islingr Carnival (CEOI14_carnival) C++17
100 / 100
34 ms 384 KB
#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for (auto i = (a); i < (b); ++i)

int ask(int l, int r) {
	cout << r - l;
	rep(i, l, r) cout << ' ' << i + 1;
	cout << endl;
	int res; cin >> res;
	return res;
}

signed main() {
	ios::sync_with_stdio(false);

	int n, cnt = 0; cin >> n;
	vector<int> c(n);
	for (int i = n; i--; ) {
		int l = i + 1, r = n + 1;
		while (r - l > 1) {
			int m = (l + r) >> 1;
			(ask(i, m) != ask(i + 1, m) ? l : r) = m;
		}
		c[i] = (l != n ? c[l] : ++cnt);
	}
	cout << 0;
	rep(i, 0, n) cout << ' ' << c[i];
	cout << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 15 ms 384 KB Output is correct
2 Correct 17 ms 384 KB Output is correct
3 Correct 20 ms 384 KB Output is correct
4 Correct 28 ms 384 KB Output is correct
5 Correct 20 ms 384 KB Output is correct
6 Correct 21 ms 384 KB Output is correct
7 Correct 16 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 384 KB Output is correct
2 Correct 23 ms 384 KB Output is correct
3 Correct 19 ms 384 KB Output is correct
4 Correct 24 ms 384 KB Output is correct
5 Correct 14 ms 384 KB Output is correct
6 Correct 16 ms 384 KB Output is correct
7 Correct 15 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 384 KB Output is correct
2 Correct 21 ms 384 KB Output is correct
3 Correct 29 ms 384 KB Output is correct
4 Correct 34 ms 384 KB Output is correct
5 Correct 19 ms 384 KB Output is correct
6 Correct 26 ms 384 KB Output is correct
7 Correct 16 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 384 KB Output is correct
2 Correct 22 ms 384 KB Output is correct
3 Correct 23 ms 384 KB Output is correct
4 Correct 19 ms 384 KB Output is correct
5 Correct 12 ms 384 KB Output is correct
6 Correct 23 ms 384 KB Output is correct
7 Correct 27 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 384 KB Output is correct
2 Correct 24 ms 384 KB Output is correct
3 Correct 32 ms 384 KB Output is correct
4 Correct 25 ms 384 KB Output is correct
5 Correct 20 ms 384 KB Output is correct
6 Correct 22 ms 384 KB Output is correct
7 Correct 25 ms 384 KB Output is correct