#include "supertrees.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
const int MAXN=1100;
int par[MAXN];
void make_set(){
for(int i=0;i<MAXN;i++) par[i]=i;
}
int find(int node){
if(node==par[node]) return node;
return par[node]=find(par[node]);
}
void merge(int a,int b){
par[find(a)]=b;
}
int construct(vector<vector<int>> p) {
int n = p.size();
vector<vector<int>> answer(n,vector<int>(n,0));
make_set();
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(find(i)==find(j)) answer[i][j]=0;
else{
merge(i,j);
answer[i][j]=1;
}
}
}
build(answer);
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
b is not symmetric: b[0][1] (1) != b[1][0] (0) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
b is not symmetric: b[0][1] (1) != b[1][0] (0) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
b is not symmetric: b[0][1] (1) != b[1][0] (0) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
b is not symmetric: b[0][1] (1) != b[1][0] (0) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
b is not symmetric: b[0][1] (1) != b[1][0] (0) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
b is not symmetric: b[0][1] (1) != b[1][0] (0) |
3 |
Halted |
0 ms |
0 KB |
- |