#include "supertrees.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1005;
int marc[MAXN];
int construct(vector<vector<int>> p) {
int n = p.size();
vector<vector<int>> ans; ans.resize(n);
for(int i = 0; i < n; i++){
ans[i].resize(n);
for(int j = 0; j < n; j++)ans[i][j] = 0;
}
int nxt = 1;
for(int i = 0; i < n; i++){
if(marc[i]){
for(int j = 0; j < n; j++){
if(p[i][j] && marc[j] != marc[i])return 0;
if(!p[i][j] && marc[j] == marc[i])return 0;
}
}else{
int lst = -1;
for(int j = 0; j < n; j++)
if(p[i][j]){
marc[j] = nxt;
if(lst != -1){ans[lst][j] = 1; ans[j][lst] = 1;}
lst = j;
}
nxt++;
}
}
build(ans);
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... |