#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;
const int N=156;
set<int> adj[N];
int cnt=1;
bool vis[N];
int c[N];
void dfs(int u){
if(vis[u]) return;
c[u]=cnt;
vis[u]=1;
for(int v:adj[u]) {
dfs(v);
}
}
int main()
{
// ios_base:: sync_with_stdio(false); cin.tie(0);
int n; cin>>n;
for(int i=1; i<=n; i++) {
for(int j=i+1; j<=n; j++) {
if(adj[i].count(j)) {
continue;
}
cout<<2<<" ";
cout<<i<<" "<<j<<endl;
fflush(stdout);
int t;
cin>>t;
if(t==1) {
adj[i].insert(j);
adj[j].insert(i);
}
}
}
for(int i=1; i<=n; i++) {
if(!vis[i]) {
dfs(i);
cnt++;
}
}
cout<<"0 ";
for(int i=1; i<=n; i++) {
cout<<c[i]<<" ";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
88 ms |
504 KB |
Partially correct |
2 |
Partially correct |
44 ms |
332 KB |
Partially correct |
3 |
Partially correct |
56 ms |
384 KB |
Partially correct |
4 |
Partially correct |
56 ms |
384 KB |
Partially correct |
5 |
Partially correct |
36 ms |
704 KB |
Partially correct |
6 |
Partially correct |
78 ms |
1096 KB |
Partially correct |
7 |
Partially correct |
43 ms |
424 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
73 ms |
412 KB |
Partially correct |
2 |
Partially correct |
54 ms |
412 KB |
Partially correct |
3 |
Partially correct |
43 ms |
384 KB |
Partially correct |
4 |
Partially correct |
89 ms |
384 KB |
Partially correct |
5 |
Partially correct |
86 ms |
700 KB |
Partially correct |
6 |
Partially correct |
42 ms |
1016 KB |
Partially correct |
7 |
Partially correct |
38 ms |
376 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
70 ms |
1064 KB |
Partially correct |
2 |
Partially correct |
79 ms |
424 KB |
Partially correct |
3 |
Partially correct |
84 ms |
412 KB |
Partially correct |
4 |
Partially correct |
61 ms |
256 KB |
Partially correct |
5 |
Partially correct |
118 ms |
504 KB |
Partially correct |
6 |
Partially correct |
74 ms |
848 KB |
Partially correct |
7 |
Partially correct |
111 ms |
256 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
78 ms |
552 KB |
Partially correct |
2 |
Partially correct |
67 ms |
564 KB |
Partially correct |
3 |
Partially correct |
95 ms |
384 KB |
Partially correct |
4 |
Partially correct |
83 ms |
256 KB |
Partially correct |
5 |
Partially correct |
51 ms |
532 KB |
Partially correct |
6 |
Partially correct |
54 ms |
508 KB |
Partially correct |
7 |
Partially correct |
63 ms |
384 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
86 ms |
760 KB |
Partially correct |
2 |
Partially correct |
95 ms |
424 KB |
Partially correct |
3 |
Partially correct |
117 ms |
328 KB |
Partially correct |
4 |
Partially correct |
34 ms |
320 KB |
Partially correct |
5 |
Partially correct |
96 ms |
404 KB |
Partially correct |
6 |
Partially correct |
52 ms |
384 KB |
Partially correct |
7 |
Partially correct |
61 ms |
256 KB |
Partially correct |