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;
int pai[155];
int cor[155];
int find(int x){
return (x==pai[x] ? x : pai[x]= find(pai[x]));
}
void join(int a,int b){
a = find(a);
b = find(b);
pai[a] = b;
}
int main(){
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int n;
cin>>n;
cout<<n;
for(int i=1;i<=n;i++)cout<<" "<<i;
for(int i=1;i<=n;i++)pai[i] = i;
cout<<endl;
int C;
cin>>C;
int comp = n;
for(int i=1;i<=n;i++)cor[i] = -1;
int cur=1;
for(int i=1;i<=n;i++){
if(cor[i]!=-1)continue;
cor[i] = cur;
for(int j=i+1;j<=n;j++){
if(comp==C)break;
cout<<2<<" "<<i<<" "<<j<<endl;
int s;
cin>>s;
if(s==1){
cor[j] = cur;
join(i,j);
comp--;
}
}
cur++;
}
for(int i=1;i<=n;i++){
if(cor[i]==-1){
cor[i]=cur;
cur++;
}
}
cout<<0;
for(int i=1;i<=n;i++)cout<<" "<<cor[i];
cout<<endl;
}
# | 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... |