#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
#define rep(i, n) for (int (i) = 0; (i) < (n); ++(i))
#define all(x) (x).begin(), (x).end()
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define f first
#define s second
const int MAXN = 155;
int n;
int a[MAXN];
int cnt[MAXN][MAXN];
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() {
FAST_IO;
cin >> n;
cnt[n - 1][n - 1] = 1;
fill(a, a + n, -1);
int last = 1;
a[n - 1] = 0;
for (int i = n - 2; i >= 0; --i) {
int l = i, r = n;
while (r - l > 1) {
int m = l + (r - l) / 2;
if (ask(i, m) == cnt[i + 1][m] + 1) {
l = m;
} else {
r = m;
}
}
if (r == n) a[i] = last++;
else a[i] = a[r];
// for (int j = i + 1; j < n; ++j) {
// int x = ask(i, j);
// if (x != cnt[i + 1][j] + 1) {
// a[i] = a[j];
// break;
// }
// }
// if (a[i] == -1) a[i] = last++;
set<int> s;
for (int j = i; j < n; ++j) {
s.insert(a[j]);
cnt[i][j] = s.size();
}
}
cout << 0;
rep(i, n) {
cout << ' ' << a[i] + 1;
}
cout << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
376 KB |
Output is correct |
2 |
Correct |
8 ms |
340 KB |
Output is correct |
3 |
Correct |
15 ms |
376 KB |
Output is correct |
4 |
Correct |
16 ms |
424 KB |
Output is correct |
5 |
Correct |
10 ms |
376 KB |
Output is correct |
6 |
Correct |
11 ms |
376 KB |
Output is correct |
7 |
Correct |
15 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
376 KB |
Output is correct |
2 |
Correct |
14 ms |
376 KB |
Output is correct |
3 |
Correct |
11 ms |
376 KB |
Output is correct |
4 |
Correct |
12 ms |
336 KB |
Output is correct |
5 |
Correct |
12 ms |
376 KB |
Output is correct |
6 |
Correct |
13 ms |
376 KB |
Output is correct |
7 |
Correct |
14 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
376 KB |
Output is correct |
2 |
Correct |
13 ms |
376 KB |
Output is correct |
3 |
Correct |
15 ms |
376 KB |
Output is correct |
4 |
Correct |
12 ms |
424 KB |
Output is correct |
5 |
Correct |
14 ms |
296 KB |
Output is correct |
6 |
Correct |
9 ms |
504 KB |
Output is correct |
7 |
Correct |
16 ms |
424 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
416 KB |
Output is correct |
2 |
Correct |
13 ms |
376 KB |
Output is correct |
3 |
Correct |
18 ms |
376 KB |
Output is correct |
4 |
Correct |
20 ms |
424 KB |
Output is correct |
5 |
Correct |
17 ms |
424 KB |
Output is correct |
6 |
Correct |
14 ms |
424 KB |
Output is correct |
7 |
Correct |
15 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
380 KB |
Output is correct |
2 |
Correct |
13 ms |
504 KB |
Output is correct |
3 |
Correct |
11 ms |
340 KB |
Output is correct |
4 |
Correct |
18 ms |
376 KB |
Output is correct |
5 |
Correct |
15 ms |
416 KB |
Output is correct |
6 |
Correct |
11 ms |
420 KB |
Output is correct |
7 |
Correct |
21 ms |
424 KB |
Output is correct |