#include <bits/stdc++.h>
using namespace std;
const int N = 155;
vector<int> vec[N];
int n, color[N];
int cnt = 1;
int get(vector<int> &a) {
cout << a.size() << ' ';
for (int u : a) cout << u << ' ';
cout << endl;
int ret; cin >> ret; return ret;
}
bool inside(int l, int r, int cur) {
vector<int> a;
for (int c = l; c <= r; ++c) a.push_back(vec[c][0]);
a.push_back(cur);
int x = r - l + 1;
int y = get(a);
if (x == y) return true; // inside
else return false;
}
bool ask(int l, int r, int cur) {
if (l == r) {
if (inside(l, r, cur)) { vec[l].push_back(cur); return true; }
else return false;
}
int mid = ((l + r) >> 1);
if (inside(l, mid, cur)) return ask(l, mid, cur);
else return ask(mid + 1, r, cur);
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(0);
cin >> n;
vec[1].push_back(1);
for (int i = 2; i <= n; ++i) {
bool done = ask(1, cnt, i);
if (!done) {
vec[++cnt].push_back(i);
}
}
for (int i = 1; i <= cnt; ++i) {
for (int u : vec[i]) color[u] = i;
}
// output
cout << 0 << ' ';
for (int i = 1; i <= n; ++i) cout << color[i] << ' '; cout << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
2180 KB |
Output is correct |
2 |
Correct |
3 ms |
2180 KB |
Output is correct |
3 |
Correct |
3 ms |
2180 KB |
Output is correct |
4 |
Correct |
6 ms |
2180 KB |
Output is correct |
5 |
Correct |
3 ms |
2180 KB |
Output is correct |
6 |
Correct |
3 ms |
2180 KB |
Output is correct |
7 |
Correct |
6 ms |
2180 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
2180 KB |
Output is correct |
2 |
Correct |
9 ms |
2180 KB |
Output is correct |
3 |
Correct |
3 ms |
2180 KB |
Output is correct |
4 |
Correct |
0 ms |
2180 KB |
Output is correct |
5 |
Correct |
3 ms |
2180 KB |
Output is correct |
6 |
Correct |
3 ms |
2180 KB |
Output is correct |
7 |
Correct |
0 ms |
2180 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
2180 KB |
Output is correct |
2 |
Correct |
3 ms |
2180 KB |
Output is correct |
3 |
Correct |
3 ms |
2180 KB |
Output is correct |
4 |
Correct |
6 ms |
2180 KB |
Output is correct |
5 |
Correct |
0 ms |
2180 KB |
Output is correct |
6 |
Correct |
0 ms |
2180 KB |
Output is correct |
7 |
Correct |
0 ms |
2180 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
2180 KB |
Output is correct |
2 |
Correct |
6 ms |
2180 KB |
Output is correct |
3 |
Correct |
6 ms |
2180 KB |
Output is correct |
4 |
Correct |
13 ms |
2180 KB |
Output is correct |
5 |
Correct |
0 ms |
2180 KB |
Output is correct |
6 |
Correct |
3 ms |
2180 KB |
Output is correct |
7 |
Correct |
3 ms |
2180 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2180 KB |
Output is correct |
2 |
Correct |
3 ms |
2180 KB |
Output is correct |
3 |
Correct |
9 ms |
2180 KB |
Output is correct |
4 |
Correct |
0 ms |
2180 KB |
Output is correct |
5 |
Correct |
3 ms |
2180 KB |
Output is correct |
6 |
Correct |
6 ms |
2180 KB |
Output is correct |
7 |
Correct |
3 ms |
2180 KB |
Output is correct |