#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ld double
// #define endl "\n"
const int N = 200;
int num[N + 1],occ[N + 1];
int ask(vector<int> curr) {
cout<<curr.size()<<endl;
for(auto u : curr) {
cout<<u<<" ";
}
cout<<endl;
int x;
cin>>x;
return x;
}
int pa[N + 1],cnt[N + 1];
int find(int a) {
if(a == pa[a]) return a;
return pa[a] = find(pa[a]);
}
void unite(int a,int b) {
a = find(a);
b = find(b);
if(a == b) return;
if(cnt[a] < cnt[b]) swap(a,b);
pa[b] = a;
cnt[a] += cnt[b];
}
int kq[N + 1],comp[N + 1];
signed main() {
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
// freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
// freopen("PLO.inp","r",stdin);
// freopen("PLO.out","w",stdout);
int n;
cin>>n;
for(int i = 1;i <= n;i++) {
pa[i] = i;
cnt[i] = 1;
}
for(int i = 1;i <= n;i++) {
int l = i + 1,r = n + 1,res = -1;
while(l < r) {
int mid = (l + r)/2;
vector<int> asd;
for(int j = i + 1;j <= mid;j++) {
asd.push_back(j);
}
int lst = ask(asd);
asd.push_back(i);
int curr = ask(asd);
if(curr == lst) {
r = mid;
res = mid;
} else {
l = mid + 1;
}
}
if(res != -1) {
unite(i,res);
}
}
int cnt = 0;
for(int i = 1;i <= n;i++) {
if(i == pa[i]) {
cnt++;
comp[i] = cnt;
}
}
cout<<0<<" ";
for(int i = 1;i <= n;i++) {
cout<<comp[find(i)]<<" ";
}
exit(0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
336 KB |
Output is correct |
2 |
Correct |
17 ms |
336 KB |
Output is correct |
3 |
Correct |
18 ms |
352 KB |
Output is correct |
4 |
Correct |
21 ms |
344 KB |
Output is correct |
5 |
Correct |
14 ms |
336 KB |
Output is correct |
6 |
Correct |
17 ms |
332 KB |
Output is correct |
7 |
Correct |
19 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
332 KB |
Output is correct |
2 |
Correct |
14 ms |
336 KB |
Output is correct |
3 |
Correct |
10 ms |
356 KB |
Output is correct |
4 |
Correct |
15 ms |
352 KB |
Output is correct |
5 |
Correct |
17 ms |
340 KB |
Output is correct |
6 |
Correct |
21 ms |
348 KB |
Output is correct |
7 |
Correct |
19 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
340 KB |
Output is correct |
2 |
Correct |
19 ms |
208 KB |
Output is correct |
3 |
Correct |
25 ms |
344 KB |
Output is correct |
4 |
Correct |
19 ms |
336 KB |
Output is correct |
5 |
Correct |
21 ms |
336 KB |
Output is correct |
6 |
Correct |
17 ms |
336 KB |
Output is correct |
7 |
Correct |
16 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
208 KB |
Output is correct |
2 |
Correct |
18 ms |
336 KB |
Output is correct |
3 |
Correct |
24 ms |
352 KB |
Output is correct |
4 |
Correct |
25 ms |
336 KB |
Output is correct |
5 |
Correct |
19 ms |
344 KB |
Output is correct |
6 |
Correct |
19 ms |
336 KB |
Output is correct |
7 |
Correct |
22 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
336 KB |
Output is correct |
2 |
Correct |
21 ms |
332 KB |
Output is correct |
3 |
Correct |
19 ms |
344 KB |
Output is correct |
4 |
Correct |
24 ms |
336 KB |
Output is correct |
5 |
Correct |
22 ms |
336 KB |
Output is correct |
6 |
Correct |
21 ms |
464 KB |
Output is correct |
7 |
Correct |
18 ms |
468 KB |
Output is correct |