# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1117259 | I_FloPPed21 | Connecting Supertrees (IOI20_supertrees) | C++14 | 0 ms | 0 KiB |
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 "supertrees.h"
#include <iostream>
#include <vector>
using namespace std;
const int N=1001;
vector<vector<int>>b;
int n,componente[N],cnt,root[N],modes[N][N];
bool viz[N];
void fa_dfs(int i)
{
viz[i]=true;
componente[i]=cnt;
for(int j=0; j<n; j++)
{
if(viz[j]==true)
continue;
if(modes[i][j]==1)
{
b[i][j]=1;
b[j][i]=1;
fa_dfs(j);
}
}
}
int construct(vector<vector<int>>p)
{
n=p.size();
b.resize(n);
for(int i=0;i<n;i++)
b[i].resize(n);
for(int i=0; i<n; i++)
for(int j=0; j<n; j++)
modes[i][j]=p[i][j];
for(int i=0; i<n; i++)
{
if(viz[i]==false)
{
cnt++;
viz[i]=true;
componente[i]=cnt;
fa_dfs(i);
}
}
build(b);
return 1;
}
int main()
{
cout << "Hello world!" << endl;
return 0;
}