#include <bits/stdc++.h>
using namespace std;
const int MAXN = 161;
int pai[MAXN],cor[MAXN],N,jafoi,anterior[MAXN];
int find(int x){
if(x == pai[x]) return x;
return pai[x] = find(pai[x]);
}
void join(int x,int y){
x = find(x);
y = find(y);
if(x == y) return;
if(x > y) swap(x,y);
pai[y] = x;
}
int main(){
cin >> N;
for(int i = 1;i<=N;i++) pai[i] = i;
anterior[1] = 1;
for(int u = 2;u<=N;u++){
cout << u;
for(int i = 1;i<=u;i++){
cout << " " << i;
}
cout << endl;
cin >> anterior[u];
if(anterior[u] == anterior[u-1] + 1) continue;
for(int i = 1;i<=u;i++){
if(find(i) != i) continue;
cout << 2 << " " << i << " " << u << endl;
int qtd;
cin >> qtd;
if(qtd == 2) continue;
join(u,i);
break;
}
}
cout << 0;
for(int i = 1;i<=N;i++){
if(cor[find(i)] == 0){
cor[find(i)] = ++jafoi;
}
cout << " " << cor[find(i)];
}
cout << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
248 KB |
Output is correct |
2 |
Correct |
15 ms |
436 KB |
Output is correct |
3 |
Correct |
12 ms |
436 KB |
Output is correct |
4 |
Correct |
5 ms |
436 KB |
Output is correct |
5 |
Correct |
4 ms |
436 KB |
Output is correct |
6 |
Correct |
4 ms |
436 KB |
Output is correct |
7 |
Correct |
10 ms |
436 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
436 KB |
Output is correct |
2 |
Correct |
14 ms |
436 KB |
Output is correct |
3 |
Correct |
11 ms |
436 KB |
Output is correct |
4 |
Correct |
7 ms |
484 KB |
Output is correct |
5 |
Correct |
4 ms |
504 KB |
Output is correct |
6 |
Correct |
4 ms |
504 KB |
Output is correct |
7 |
Correct |
7 ms |
504 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
504 KB |
Output is correct |
2 |
Correct |
8 ms |
656 KB |
Output is correct |
3 |
Correct |
24 ms |
656 KB |
Output is correct |
4 |
Correct |
5 ms |
656 KB |
Output is correct |
5 |
Correct |
3 ms |
656 KB |
Output is correct |
6 |
Correct |
4 ms |
656 KB |
Output is correct |
7 |
Correct |
13 ms |
656 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
656 KB |
Output is correct |
2 |
Correct |
7 ms |
656 KB |
Output is correct |
3 |
Correct |
11 ms |
656 KB |
Output is correct |
4 |
Correct |
5 ms |
656 KB |
Output is correct |
5 |
Correct |
4 ms |
656 KB |
Output is correct |
6 |
Correct |
5 ms |
656 KB |
Output is correct |
7 |
Correct |
10 ms |
656 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
656 KB |
Output is correct |
2 |
Correct |
12 ms |
656 KB |
Output is correct |
3 |
Correct |
17 ms |
656 KB |
Output is correct |
4 |
Correct |
9 ms |
656 KB |
Output is correct |
5 |
Correct |
6 ms |
656 KB |
Output is correct |
6 |
Correct |
4 ms |
656 KB |
Output is correct |
7 |
Correct |
7 ms |
656 KB |
Output is correct |