#include <bits/stdc++.h>
using namespace std;
vector<int> n;
vector<int> v;
vector<vector<int> > l;
void dfs(int i, int count){
v[i]=count;
for (int j:l[i]){
if (v[j]<0){
dfs(j,count);
}
}
}
int main(){
int N;
cin >> N;
for (int i=1;i<=N;i++){
n.push_back(-1);
l.push_back(vector<int>());
v.push_back(-1);
}
for (int i=0;i<N;i++){
for (int j=i+1;j<N;j++){
cout << 2 << " "<< i+1 << " " << j+1 << endl;
int store;
cin >> store;
if (store==1) l[i].push_back(j);
}
}
int count = 1;
for (int i=0;i<N;i++){
if (v[i]<0){
dfs(i,count);
count++;
}
}
for (int i=0;i<N;i++){
cout << v[i] << " ";
}
cout << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
88 ms |
200 KB |
Same person came twice to the party. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
113 ms |
304 KB |
Same person came twice to the party. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
83 ms |
312 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
117 ms |
284 KB |
Same person came twice to the party. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
112 ms |
312 KB |
Same person came twice to the party. |
2 |
Halted |
0 ms |
0 KB |
- |