| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 300230 | daniel920712 | Connecting Supertrees (IOI20_supertrees) | C++14 | 1212 ms | 1965544 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 <vector>
using namespace std;
vector < int > how[1005];
int Father[1005];
int Find(int here)
{
if(Father[here]==here) return here;
Father[here]=Find(Father[here]);
return here;
}
int construct(vector< vector<int> > p)
{
int n=p.size(),i,j,m;
vector< vector<int> > answer;
vector< int > row;
for(int i=0;i<n;i++) row.push_back(0);
for(int i=0;i<n;i++)
{
answer.push_back(row);
Father[i]=i;
}
for(int i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(p[i][j]==0&&Find(i)==Find(j)) return 0;
Father[Find(i)]=Find(j);
}
}
for(int i=0;i<n;i++) how[Find(i)].push_back(i);
for(int i=0;i<n;i++)
{
m=how[i].size();
if(m<=1) continue;
for(j=1;j<m;j++)
{
answer[how[i][j-1]][how[i][j]]=1;
answer[how[i][j]][how[i][j-1]]=1;
}
if(p[how[i][0]][how[i][1]]==2)
{
if(m==2) return 0;
answer[how[i][m-1]][how[i][j]]=1;
answer[how[i][j]][how[i][m-1]]=1;
}
}
build(answer);
return 1;
}
Compilation message (stderr)
| # | 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... | ||||
