#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;
const int N=156;
vector<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++) {
cout<<2<<" ";
cout<<i<<" "<<j<<endl;
fflush(stdout);
int t;
cin>>t;
if(t==1) {
adj[i].push_back(j);
adj[j].push_back(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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
45 ms |
324 KB |
Partially correct |
2 |
Partially correct |
79 ms |
376 KB |
Partially correct |
3 |
Partially correct |
88 ms |
424 KB |
Partially correct |
4 |
Partially correct |
42 ms |
256 KB |
Partially correct |
5 |
Partially correct |
33 ms |
456 KB |
Partially correct |
6 |
Partially correct |
65 ms |
496 KB |
Partially correct |
7 |
Partially correct |
64 ms |
256 KB |
Partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
73 ms |
460 KB |
Partially correct |
2 |
Partially correct |
81 ms |
300 KB |
Partially correct |
3 |
Partially correct |
36 ms |
256 KB |
Partially correct |
4 |
Partially correct |
37 ms |
384 KB |
Partially correct |
5 |
Partially correct |
85 ms |
412 KB |
Partially correct |
6 |
Partially correct |
77 ms |
428 KB |
Partially correct |
7 |
Partially correct |
60 ms |
332 KB |
Partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
37 ms |
384 KB |
Partially correct |
2 |
Partially correct |
60 ms |
256 KB |
Partially correct |
3 |
Partially correct |
73 ms |
384 KB |
Partially correct |
4 |
Partially correct |
56 ms |
384 KB |
Partially correct |
5 |
Partially correct |
35 ms |
328 KB |
Partially correct |
6 |
Partially correct |
60 ms |
368 KB |
Partially correct |
7 |
Partially correct |
83 ms |
384 KB |
Partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
62 ms |
544 KB |
Partially correct |
2 |
Partially correct |
77 ms |
332 KB |
Partially correct |
3 |
Partially correct |
94 ms |
256 KB |
Partially correct |
4 |
Partially correct |
67 ms |
384 KB |
Partially correct |
5 |
Partially correct |
74 ms |
384 KB |
Partially correct |
6 |
Partially correct |
45 ms |
460 KB |
Partially correct |
7 |
Partially correct |
77 ms |
452 KB |
Partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
39 ms |
428 KB |
Partially correct |
2 |
Partially correct |
84 ms |
324 KB |
Partially correct |
3 |
Partially correct |
70 ms |
256 KB |
Partially correct |
4 |
Partially correct |
80 ms |
384 KB |
Partially correct |
5 |
Partially correct |
73 ms |
324 KB |
Partially correct |
6 |
Partially correct |
82 ms |
456 KB |
Partially correct |
7 |
Partially correct |
73 ms |
384 KB |
Partially correct |