#include "supertrees.h"
#include <bits/stdc++.h>
using namespace std;
int construct(vector<vector<int>> p) {
int n = p.size();
vector<vector<int>> answer;
for (int i = 0; i < n; i++) {
vector<int> row;
row.resize(n);
answer.push_back(row);
}
vector<int> arr;
vector<bool> found(n);
for(int i = 0; i < n;i++){
if(p[i][i] != 1) return 0;
for(int j = 0; j < n;j++){
if(p[i][j] != p[j][i]) return 0;
if(p[i][j] == 2){
if(!found[i]){
arr.push_back(i);
found[i] = true;
} if(!found[j]){
arr.push_back(j);
found[j] = true;
}
}
}
}
if(arr.size()) arr.push_back(arr[0]);
int m = int(arr.size());
for(int i = 0; i < m;i++){
for(int j = 0; j < m;j++){
if(i==j) continue;
if(p[arr[i]][arr[j]] != 2) return 0;
}
}
for(int i = 0; i < int(arr.size()) - 1;i++){
answer[arr[i]][arr[i+1]] = answer[arr[i+1]][arr[i]] = 1;
}
build(answer);
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Too few ways to get from 0 to 1, should be 1 found 0 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Too few ways to get from 0 to 1, should be 1 found 0 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Incorrect |
0 ms |
348 KB |
Answer gives possible 0 while actual possible 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Answer gives possible 0 while actual possible 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Too few ways to get from 0 to 1, should be 1 found 0 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Too few ways to get from 0 to 1, should be 1 found 0 |
3 |
Halted |
0 ms |
0 KB |
- |