#include "supertrees.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define F first
#define S second
#define enter cout<<'\n';
#define INF 99999999999999999
#define MOD 1000000007
#define all(x) x.begin(),x.end()
vector<bool>vis(1000,0);
vector<vector<int>>g;
vector<vector<int>>ans;
ll n;
bool dfs(int start,int beg)
{
vis[start]=1;
for(int i=0;i<n;i++)
if(g[start][i]!=g[beg][i])
return 0;
for(int i=0;i<n;i++)
if(!vis[i] && g[start][i])
{
ans[i][start]=1;
ans[start][i]=1;
return dfs(i,beg);
}
ans[start][beg]=1;
ans[beg][start]=1;
return 1;
}
int construct(vector<vector<int>> p)
{
n=p.size();
g=p;
ans.assign(n,vector<int>(n,0));
for(int i=0;i<n;i++)
{
bool now=dfs(i,i);
if(!now)
return 0;
}
build(ans);
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
b[0][0] is not 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
b[0][0] is not 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
b[0][0] is not 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
b[0][0] is not 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
b[0][0] is not 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
b[0][0] is not 0 |
2 |
Halted |
0 ms |
0 KB |
- |