#include "supertrees.h"
#include <bits/stdc++.h>
#include <vector>
using namespace std;
int construct(std::vector<std::vector<int>> p)
{
int n = p.size();
std::vector<std::vector<int>> answer;
for (int i = 0; i < n; i++)
{
std::vector<int> row;
row.resize(n);
answer.push_back(row);
}
for(int i = 1; i < n ; ++ i){
answer[i-1][i] = answer[i][i-1] = 1;
}
/*map<int, int> cyc;
vector<int> cycle, line;
for (int i = 0; i < n; ++i)
{
p[i][i] = 2;
if (p[i] == vector<int>(n, 2))
{
cycle.push_back(i);
cyc[i] = 1;
}
else
{
line.push_back(i);
}
p[i][i] = 1;
}
if ((int)cycle.size() && (int)cycle.size() < 2)
return 0;
if ((int)line.size() && cycle.size())
cycle.push_back(line[0]);
for (int i = 0; i < (int)cycle.size(); ++i)
{
int j = (i + 1) % n;
answer[cycle[i]][cycle[j]] = 1;
answer[cycle[j]][cycle[i]] = 1;
}
for (int i = 1; i < (int)line.size(); ++i)
{
int x = line[i - 1], y = line[i];
answer[x][y] = answer[y][x] = 1;
for (int j = 0; j < n; ++j)
{
if (i == j)
continue;
if (p[y][j] != 1 && !cyc[j])
return 0;
}
}
for (int i = 1; i < n; ++i)
{
if (p[line[0]][i] == 2 && !cyc[i]){
return 0;
}
}*/
build(answer);
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Correct |
10 ms |
1152 KB |
Output is correct |
7 |
Correct |
246 ms |
22264 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Correct |
10 ms |
1152 KB |
Output is correct |
7 |
Correct |
246 ms |
22264 KB |
Output is correct |
8 |
Incorrect |
0 ms |
256 KB |
Too many ways to get from 0 to 1, should be 0 found no less than 1 |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
Too many ways to get from 0 to 1, should be 0 found no less than 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
Too many ways to get from 0 to 1, should be 0 found no less than 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Correct |
10 ms |
1152 KB |
Output is correct |
7 |
Correct |
246 ms |
22264 KB |
Output is correct |
8 |
Incorrect |
0 ms |
256 KB |
Too many ways to get from 0 to 1, should be 0 found no less than 1 |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Correct |
10 ms |
1152 KB |
Output is correct |
7 |
Correct |
246 ms |
22264 KB |
Output is correct |
8 |
Incorrect |
0 ms |
256 KB |
Too many ways to get from 0 to 1, should be 0 found no less than 1 |
9 |
Halted |
0 ms |
0 KB |
- |