This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |