#include<bits/stdc++.h>
#include "supertrees.h"
using namespace std;
vector<pair<int,int>>edges;
int n;
int construct(vector<vector<int>> p){
n=(int)p.size();
int odp[n][n];
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
odp[i][j]=0;
}
}
bool ifdeleted[n];
for(int i=0;i<n;i++){
ifdeleted[i]=0;
}
for(int i=0;i<n;i++){
if(ifdeleted[i])
continue;
vector<int>same;
for(int j=0;j<n;j++){
if(p[i][j]==1){
if(p[i]==p[j])
same.push_back(j);
else
return 0;
}
}
for(int j=1;j<(int)same.size();j++){
edges.push_back({same[j-1],same[j]});
ifdeleted[same[j]]=1;
for(int k=0;k<n;k++){
p[k][same[j]]=-1;
}
}
}
for(int i=0;i<(int)edges.size();i++){
//cout<<edges[i].first<<" "<<edges[i].second<<"\n";
odp[edges[i].first][edges[i].second]=1;
odp[edges[i].second][edges[i].first]=1;
}
build(odp);
return 1;
}
/*int main(){
construct({{1, 1, 2, 2}, {1, 1, 2, 2}, {2, 2, 1, 2}, {2, 2, 2, 1}});
return 0;
}*/
Compilation message
supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:45:11: error: could not convert '(int (*)[n])(& odp)' from 'int (*)[n]' to 'std::vector<std::vector<int> >'
45 | build(odp);
| ^~~
| |
| int (*)[n]