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 <bits/stdc++.h>
using namespace std;
int construct(vector<vector<int>> p)
{
int n = p.size();
// Subtask 2: line
// Subtask 3: circles
// Subtask 5: 0, 1, 2
for (int i = 0; i < n; i++)
p[i].push_back(i);
sort(p.begin(), p.end());
int l = 0, r = 1;
vector<vector<int>> answer(n, vector<int>(n));
while (r < n)
{
int i = 0;
for (; i < n; i++)
{
if (p[r][i] != p[r-1][i])
break;
}
if (i == n)
{
answer[p[r-1].back()][p[r].back()] = 1;
answer[p[r].back()][p[r-1].back()] = 1;
}
else
{
int sz = 0;
for (int j = 0; j < n; j++)
{
if (p[r-1][j])
sz++;
}
if (r - l != sz)
return 0;
l = r;
}
r++;
}
build(answer);
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... |