#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) {
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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
19 ms |
376 KB |
Output is correct |
2 |
Partially correct |
50 ms |
400 KB |
Partially correct |
3 |
Partially correct |
99 ms |
372 KB |
Partially correct |
4 |
Partially correct |
124 ms |
460 KB |
Partially correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
6 |
Correct |
5 ms |
376 KB |
Output is correct |
7 |
Correct |
29 ms |
372 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
376 KB |
Output is correct |
2 |
Correct |
43 ms |
376 KB |
Output is correct |
3 |
Partially correct |
63 ms |
396 KB |
Partially correct |
4 |
Partially correct |
110 ms |
420 KB |
Partially correct |
5 |
Correct |
11 ms |
336 KB |
Output is correct |
6 |
Correct |
18 ms |
424 KB |
Output is correct |
7 |
Correct |
23 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
376 KB |
Output is correct |
2 |
Correct |
15 ms |
376 KB |
Output is correct |
3 |
Partially correct |
80 ms |
360 KB |
Partially correct |
4 |
Partially correct |
148 ms |
512 KB |
Partially correct |
5 |
Correct |
21 ms |
336 KB |
Output is correct |
6 |
Correct |
43 ms |
424 KB |
Output is correct |
7 |
Partially correct |
57 ms |
428 KB |
Partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
376 KB |
Output is correct |
2 |
Correct |
12 ms |
376 KB |
Output is correct |
3 |
Partially correct |
113 ms |
424 KB |
Partially correct |
4 |
Partially correct |
142 ms |
540 KB |
Partially correct |
5 |
Partially correct |
54 ms |
516 KB |
Partially correct |
6 |
Partially correct |
77 ms |
408 KB |
Partially correct |
7 |
Partially correct |
52 ms |
400 KB |
Partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
29 ms |
416 KB |
Output is correct |
3 |
Partially correct |
74 ms |
516 KB |
Partially correct |
4 |
Partially correct |
120 ms |
532 KB |
Partially correct |
5 |
Partially correct |
62 ms |
424 KB |
Partially correct |
6 |
Partially correct |
88 ms |
428 KB |
Partially correct |
7 |
Partially correct |
108 ms |
424 KB |
Partially correct |