#include <bits/stdc++.h>
using namespace std;
const int N = 155;
int n;
int color[N];
int get(vector<int> val) {
cout << val.size() << ' ';
for (int v : val) {
cout << v << ' ';
}
cout << endl;
int ans;
cin >> ans;
return ans;
}
bool hasSame(int u, vector<int> val) {
if (val.empty()) return false;
int x = get(val);
val.push_back(u);
int y = get(val);
return x == y;
}
int main() {
cin >> n;
int cnt = 0;
for (int i = 1; i <= n; ++i) if (!color[i]) {
color[i] = ++cnt;
vector<int> val;
for (int j = i + 1; j <= n; ++j) {
if (!color[j]) {
val.push_back(j);
}
}
while (!val.empty() && hasSame(i, val)) {
int l = 0, r = val.size() - 1;
while (l < r) {
int md = (l + r) >> 1;
if (hasSame(i, vector<int>(val.begin(), val.begin() + md + 1))) {
r = md;
} else {
l = md + 1;
}
}
color[val[l]] = cnt;
val = vector<int>(val.begin() + l + 1, val.end());
}
}
cout << 0 << ' ';
for (int i = 1; i <= n; ++i) {
cout << color[i] << ' ';
}
cout << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
25 ms |
384 KB |
Output is correct |
2 |
Correct |
9 ms |
384 KB |
Output is correct |
3 |
Correct |
7 ms |
392 KB |
Output is correct |
4 |
Correct |
7 ms |
256 KB |
Output is correct |
5 |
Correct |
27 ms |
256 KB |
Output is correct |
6 |
Correct |
14 ms |
256 KB |
Output is correct |
7 |
Correct |
19 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
21 ms |
384 KB |
Output is correct |
2 |
Correct |
13 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
256 KB |
Output is correct |
4 |
Correct |
7 ms |
256 KB |
Output is correct |
5 |
Correct |
11 ms |
256 KB |
Output is correct |
6 |
Correct |
23 ms |
384 KB |
Output is correct |
7 |
Correct |
9 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
17 ms |
256 KB |
Output is correct |
2 |
Correct |
9 ms |
256 KB |
Output is correct |
3 |
Correct |
20 ms |
384 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
5 |
Correct |
15 ms |
256 KB |
Output is correct |
6 |
Correct |
20 ms |
384 KB |
Output is correct |
7 |
Correct |
9 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
256 KB |
Output is correct |
2 |
Correct |
21 ms |
256 KB |
Output is correct |
3 |
Correct |
6 ms |
256 KB |
Output is correct |
4 |
Correct |
7 ms |
256 KB |
Output is correct |
5 |
Correct |
18 ms |
384 KB |
Output is correct |
6 |
Correct |
8 ms |
256 KB |
Output is correct |
7 |
Correct |
14 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
256 KB |
Output is correct |
2 |
Correct |
15 ms |
384 KB |
Output is correct |
3 |
Correct |
15 ms |
256 KB |
Output is correct |
4 |
Correct |
15 ms |
256 KB |
Output is correct |
5 |
Correct |
13 ms |
256 KB |
Output is correct |
6 |
Correct |
6 ms |
316 KB |
Output is correct |
7 |
Correct |
8 ms |
384 KB |
Output is correct |