#include "supertrees.h"
#include <bits/stdc++.h>
using namespace std;
int construct(vector<vector<int>> p){
int N = p.size();
for(int i = 0; i < N; i++){
unordered_map<int, int> freq;
for(int j = 0; j < N; j++){
freq[p[i][j]]++;
}
for(auto x : freq){
if(x.first == 0 or x.first == 1) continue;
if(x.second == 1) return 0;
}
}
vector<vector<int>> b(N, vector<int>(N, 0));
for(int i = 0; i < N; i++){
if(i != N - 1){
if(p[i][i + 1] == 1){
b[i][i + 1] = 1;
b[i + 1][i] = 1;
}
else{
int j = i + 2;
while(p[i][j] == 0 and j < N){
j++;
}
if(j != N){
b[i][j] = 1;
b[j][i] = 1;
}
}
}
}
build(b);
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
508 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
6 ms |
1108 KB |
Output is correct |
7 |
Correct |
142 ms |
22096 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
508 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
6 ms |
1108 KB |
Output is correct |
7 |
Correct |
142 ms |
22096 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
5 ms |
1340 KB |
Output is correct |
13 |
Correct |
126 ms |
23888 KB |
Output is correct |
14 |
Incorrect |
0 ms |
348 KB |
Answer gives possible 1 while actual possible 0 |
15 |
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 |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Incorrect |
0 ms |
348 KB |
Too few ways to get from 0 to 1, should be 2 found 0 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
1 ms |
344 KB |
Too few ways to get from 0 to 1, should be 2 found 0 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
508 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
6 ms |
1108 KB |
Output is correct |
7 |
Correct |
142 ms |
22096 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
5 ms |
1340 KB |
Output is correct |
13 |
Correct |
126 ms |
23888 KB |
Output is correct |
14 |
Incorrect |
0 ms |
348 KB |
Answer gives possible 1 while actual possible 0 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
508 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
6 ms |
1108 KB |
Output is correct |
7 |
Correct |
142 ms |
22096 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
5 ms |
1340 KB |
Output is correct |
13 |
Correct |
126 ms |
23888 KB |
Output is correct |
14 |
Incorrect |
0 ms |
348 KB |
Answer gives possible 1 while actual possible 0 |
15 |
Halted |
0 ms |
0 KB |
- |