This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#include "supertrees.h"
int n, par[1005];
int find(int u){
if(par[u] == u) return u;
par[u] = find(par[u]);
return par[u];
}
void union_(int u, int v){
par[find(u)] = find(v);
}
int construct(vector<vector<int> > p){
n = p.size();
for(int i = 0; i < n; i++) par[i] = i;
vector<vector<int> > b(n, vector<int>(n));
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
if(p[i][j] && find(i) != find(j)){
union_(i, j);
b[i][j] = b[j][i] = 1;
}else if(!p[i][j] && find(i) == find(j)) return 0;
}
}
build(b);
return 1;
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |