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>
#include <bits/stdc++.h>
using namespace std;
int construct(std::vector<std::vector<int>> p) {
int n = p.size();
bool sub_task_1 = true;
bool sub_task_2 = true;
for (int i = 0; i < n; i++){
for (int j = 0; j < n; j++){
if (p[i][j] != 1){
sub_task_1 = false;
}
if (p[i][j] != 2 and p[i][j] != 3){
sub_task_2 = false;
}
}
}
std::vector<std::vector<int>> answer;
for (int i = 0; i < n; i++) {
std::vector<int> row;
row.resize(n);
answer.push_back(row);
}
if (n == 1){
//nothing to change
}
else if (sub_task_1){ // p[i][j] = 1
for (int i = 0; i < n - 1; i++){
answer[i][i + 1] = 1;
answer[i + 1][i] = 1;
}
}
else if(sub_task_2) { // p[i][j] = 1 or p[i][j] = 0
for (int i = 0; i < n; i++){
for (int j = 0; j < n; j++){
if (i != j and p[i][j]){
answer[i][j] = 1;
}
}
}
}
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... |