#include<bits/stdc++.h>
using namespace std;
int par[155],ans[155];
vector<int> kel[155];
int find(int x){
if(par[x]==x)return x;
return par[x]=find(par[x]);
}
void join(int x,int y){
par[find(x)]=find(y);
}
int main(){
int n,x;
cin >> n;
for(int i=1;i<=n;i++)par[i]=i;
for(int i=1;i<=n;i++){
for(int j=i+1;j<=n;j++){
cout << 2 << " " << i << " " << j << endl;
cin >> x;
if(x==1)join(i,j);
}
}
for(int i=1;i<=n;i++)kel[find(i)].push_back(i);
int no=0;
for(int i=1;i<=n;i++){
if(kel[i].empty())continue;
no++;
for(auto isi : kel[i])ans[isi]=no;
}
cout << 0;
for(int i=1;i<=n;i++)cout << " " << ans[i];
cout << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
62 ms |
256 KB |
Partially correct |
2 |
Partially correct |
76 ms |
256 KB |
Partially correct |
3 |
Partially correct |
88 ms |
256 KB |
Partially correct |
4 |
Partially correct |
51 ms |
372 KB |
Partially correct |
5 |
Partially correct |
90 ms |
256 KB |
Partially correct |
6 |
Partially correct |
77 ms |
376 KB |
Partially correct |
7 |
Partially correct |
90 ms |
256 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
246 ms |
256 KB |
Partially correct |
2 |
Partially correct |
57 ms |
256 KB |
Partially correct |
3 |
Partially correct |
43 ms |
368 KB |
Partially correct |
4 |
Partially correct |
96 ms |
376 KB |
Partially correct |
5 |
Partially correct |
95 ms |
384 KB |
Partially correct |
6 |
Partially correct |
94 ms |
376 KB |
Partially correct |
7 |
Partially correct |
92 ms |
256 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
83 ms |
376 KB |
Partially correct |
2 |
Partially correct |
93 ms |
376 KB |
Partially correct |
3 |
Partially correct |
89 ms |
256 KB |
Partially correct |
4 |
Partially correct |
103 ms |
376 KB |
Partially correct |
5 |
Partially correct |
104 ms |
256 KB |
Partially correct |
6 |
Partially correct |
99 ms |
256 KB |
Partially correct |
7 |
Partially correct |
86 ms |
372 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
90 ms |
256 KB |
Partially correct |
2 |
Partially correct |
113 ms |
256 KB |
Partially correct |
3 |
Partially correct |
92 ms |
376 KB |
Partially correct |
4 |
Partially correct |
110 ms |
256 KB |
Partially correct |
5 |
Partially correct |
89 ms |
376 KB |
Partially correct |
6 |
Partially correct |
102 ms |
256 KB |
Partially correct |
7 |
Partially correct |
97 ms |
256 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
165 ms |
384 KB |
Partially correct |
2 |
Partially correct |
102 ms |
256 KB |
Partially correct |
3 |
Partially correct |
103 ms |
384 KB |
Partially correct |
4 |
Partially correct |
93 ms |
256 KB |
Partially correct |
5 |
Partially correct |
74 ms |
372 KB |
Partially correct |
6 |
Partially correct |
102 ms |
256 KB |
Partially correct |
7 |
Partially correct |
107 ms |
256 KB |
Partially correct |