#include "Joi.h"
#include <bits/stdc++.h>
using namespace std;
int Ps[100000] , Pi[100000];
vector<int> ad[100000];
int lJOI[100000];
int findjoi(int x){
return Pi[x] == x ? x : Pi[x] = findjoi(Pi[x]);
}
void joinjoi(int x , int y){
x = findjoi(x) , y = findjoi(y);
if(Ps[x] > Ps[y]) swap(x,y);
Pi[x] = y , Ps[y] += Ps[x];
}
void dfsJOI(int x , int y){
if(findjoi(x) != findjoi(y) && (Ps[findjoi(x)] +Ps[findjoi(y)]) <= 60){
joinjoi(x , y);
}
lJOI[x] = Ps[findjoi(x)] - 1;
for(auto p : ad[x]){
if(p == y) continue;
dfsJOI(p , x);
}
}
void Joi(int N, int M, int A[], int B[], long long X, int T) {
for(int i = 0 ; i < N ; i ++){
Ps[i] = 1 , Pi[i] = i;
}
for(int i = 0 ; i < M ; i ++){
if(findjoi(A[i]) != findjoi(B[i])){
joinjoi(A[i] , B[i]);
ad[A[i]].push_back(B[i]);
ad[B[i]].push_back(A[i]);
}
}
for(int i = 0 ; i < N ; i ++){
Ps[i] = 1 , Pi[i] = i;
}
dfsJOI(0 , 0);
for(int i = 0 ; i < N ; i ++){
int U = (1LL<<(lJOI[i]));
U &= X;
if(U > 0) U = 1;
MessageBoard(i , U);
}
}
#include "Ioi.h"
long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
return 0LL;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
5360 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
27 ms |
7880 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
7880 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
15 ms |
7880 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
28 ms |
8416 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |