# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
17300 | gs14004 | 지도 색칠하기 (GA3_map) | C++14 | 1500 ms | 1088 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
struct disj{
int pa[42];
void init(int n){
for(int i=1; i<=n; i++) pa[i] = i;
}
int find(int x){
return pa[x] = (pa[x] == x ? x : find(pa[x]));
}
bool uni(int p, int q){
p = find(p);
q = find(q);
if(p == q) return 0;
pa[q] = p;
return 1;
}
}disj;
long long NumberOfMaps (int N, int M, int *A, int *B){
long long sum = 0;
for(int i=0; i<(1<<(N-1)); i++){
disj.init(2*N);
bool bad = 0;
for(int j=0; j<M; j++){
if(((i >> (A[j] - 1)) & 1) == ((i >> (B[j] - 1)) & 1)){
disj.uni(A[j], B[j] + N);
disj.uni(B[j], A[j] + N);
if(disj.find(A[j]) == disj.find(A[j] + N)){
bad = 1;
break;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |