#include<bits/stdc++.h>
using namespace std;
int ask(vector<int> &v) {
int x;
cout << v.size() << ' ';
for (int i: v) cout << i << ' ';
cout << endl;
cin >> x;
return x;
}
int col[155], C[100000];
vector<int> v;
void solve() {
int n;
cin >> n;
set<int> s;
for (int i = 1; i <= n; i++) col[i] = i;
for (int i = 1; i <= n; i++) {
v.clear();
int l = i+1, r = n, mid, pos = 1e9;
while(l <= r) {
v.clear();
mid = (l + r) / 2;
for (int j = i; j <= mid; j++) {
v.push_back(j);
}
int ans = ask(v);
v.erase(v.begin());
int ans2 = ask(v);
if(ans == ans2) {
pos = min(pos, mid);
r = mid - 1;
}
else l = mid + 1;
}
if(pos != 1e9) col[pos] = col[i];
//cout << "DM " << i << ' ' << pos << '\n';
}
cout << 0 << ' ';
for (int i = 1; i <= n; i++) s.insert(col[i]);
int cnt = 0;
for (int i: s) C[i] = ++cnt;
for (int i = 1; i <= n; i++) cout << C[col[i]] << ' ';
}
signed main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int t = 1;
// cin >> t;
while(t--) {
solve();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
344 KB |
Output is correct |
2 |
Correct |
9 ms |
344 KB |
Output is correct |
3 |
Correct |
12 ms |
344 KB |
Output is correct |
4 |
Correct |
21 ms |
436 KB |
Output is correct |
5 |
Correct |
7 ms |
344 KB |
Output is correct |
6 |
Correct |
8 ms |
344 KB |
Output is correct |
7 |
Correct |
10 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
340 KB |
Output is correct |
2 |
Correct |
10 ms |
592 KB |
Output is correct |
3 |
Correct |
12 ms |
344 KB |
Output is correct |
4 |
Correct |
12 ms |
436 KB |
Output is correct |
5 |
Correct |
8 ms |
344 KB |
Output is correct |
6 |
Correct |
8 ms |
340 KB |
Output is correct |
7 |
Correct |
9 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
344 KB |
Output is correct |
2 |
Correct |
8 ms |
344 KB |
Output is correct |
3 |
Correct |
16 ms |
340 KB |
Output is correct |
4 |
Correct |
18 ms |
436 KB |
Output is correct |
5 |
Correct |
12 ms |
460 KB |
Output is correct |
6 |
Correct |
9 ms |
344 KB |
Output is correct |
7 |
Correct |
14 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
344 KB |
Output is correct |
2 |
Correct |
11 ms |
852 KB |
Output is correct |
3 |
Correct |
18 ms |
464 KB |
Output is correct |
4 |
Correct |
15 ms |
344 KB |
Output is correct |
5 |
Correct |
11 ms |
344 KB |
Output is correct |
6 |
Correct |
10 ms |
344 KB |
Output is correct |
7 |
Correct |
13 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
344 KB |
Output is correct |
2 |
Correct |
11 ms |
344 KB |
Output is correct |
3 |
Correct |
16 ms |
456 KB |
Output is correct |
4 |
Correct |
12 ms |
344 KB |
Output is correct |
5 |
Correct |
16 ms |
344 KB |
Output is correct |
6 |
Correct |
18 ms |
440 KB |
Output is correct |
7 |
Correct |
14 ms |
596 KB |
Output is correct |