#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] = (r != n + 1 ? c[l] : ++cnt);
}
cout << 0;
rep(i, 0, n) cout << ' ' << c[i];
cout << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
384 KB |
Output is correct |
2 |
Correct |
18 ms |
384 KB |
Output is correct |
3 |
Correct |
22 ms |
384 KB |
Output is correct |
4 |
Correct |
23 ms |
384 KB |
Output is correct |
5 |
Correct |
14 ms |
384 KB |
Output is correct |
6 |
Correct |
13 ms |
384 KB |
Output is correct |
7 |
Correct |
16 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
384 KB |
Output is correct |
2 |
Correct |
20 ms |
384 KB |
Output is correct |
3 |
Correct |
15 ms |
384 KB |
Output is correct |
4 |
Correct |
24 ms |
384 KB |
Output is correct |
5 |
Correct |
18 ms |
384 KB |
Output is correct |
6 |
Correct |
14 ms |
384 KB |
Output is correct |
7 |
Correct |
17 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
384 KB |
Output is correct |
2 |
Correct |
18 ms |
384 KB |
Output is correct |
3 |
Correct |
21 ms |
384 KB |
Output is correct |
4 |
Correct |
24 ms |
384 KB |
Output is correct |
5 |
Correct |
18 ms |
384 KB |
Output is correct |
6 |
Correct |
16 ms |
384 KB |
Output is correct |
7 |
Correct |
19 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
384 KB |
Output is correct |
2 |
Correct |
17 ms |
384 KB |
Output is correct |
3 |
Correct |
31 ms |
384 KB |
Output is correct |
4 |
Correct |
36 ms |
384 KB |
Output is correct |
5 |
Correct |
24 ms |
384 KB |
Output is correct |
6 |
Correct |
19 ms |
384 KB |
Output is correct |
7 |
Correct |
12 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
384 KB |
Output is correct |
2 |
Correct |
25 ms |
384 KB |
Output is correct |
3 |
Correct |
22 ms |
384 KB |
Output is correct |
4 |
Correct |
30 ms |
384 KB |
Output is correct |
5 |
Correct |
19 ms |
384 KB |
Output is correct |
6 |
Correct |
31 ms |
384 KB |
Output is correct |
7 |
Correct |
27 ms |
384 KB |
Output is correct |