#include "supertrees.h"
#include<bits/stdc++.h>
using namespace std;
const int N = 1010;
int res[N][N];
int pai[N];
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);
}
build(answer);
*/
memset(pai, -1, sizeof pai);
int n = p.size();
for(int i = 0;i < n;i++){
if(pai[i] == -1) pai[i] = i;
else continue;
for(int j = 0;j < n;j++){
if(i == j) continue;
if(pai[j] != -1) continue;
if(p[i][j] == 1) pai[j] = i;
}
}
for(int i = 0;i < n;i++){
res[i][pai[i]] = res[pai[i]][i] = 1;
res[i][i] = 0;
for(int j = 0;j < n;j++){
if((pai[i] == pai[j]) != (p[i][j])){
return 0;
}
}
}
vector <vector <int>> answer;
for(int i = 0;i < n;i++){
vector <int> aux;
for(int j = 0;j < n;j++){
aux.push_back(res[i][j]);
}
answer.push_back(aux);
}
build(answer);
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 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 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
6 ms |
3420 KB |
Output is correct |
7 |
Correct |
128 ms |
27920 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 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 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
6 ms |
3420 KB |
Output is correct |
7 |
Correct |
128 ms |
27920 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 |
344 KB |
Output is correct |
12 |
Correct |
5 ms |
3496 KB |
Output is correct |
13 |
Correct |
113 ms |
27860 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
3 ms |
860 KB |
Output is correct |
17 |
Correct |
58 ms |
10252 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
29 ms |
8256 KB |
Output is correct |
21 |
Correct |
116 ms |
27984 KB |
Output is correct |
22 |
Correct |
112 ms |
27988 KB |
Output is correct |
23 |
Correct |
123 ms |
27988 KB |
Output is correct |
24 |
Correct |
120 ms |
27988 KB |
Output is correct |
25 |
Correct |
50 ms |
13236 KB |
Output is correct |
26 |
Correct |
46 ms |
12372 KB |
Output is correct |
27 |
Correct |
117 ms |
27920 KB |
Output is correct |
28 |
Correct |
113 ms |
28084 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 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 |
344 KB |
Output is correct |
5 |
Incorrect |
1 ms |
348 KB |
Answer gives possible 0 while actual possible 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Answer gives possible 0 while actual possible 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 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 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
6 ms |
3420 KB |
Output is correct |
7 |
Correct |
128 ms |
27920 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 |
344 KB |
Output is correct |
12 |
Correct |
5 ms |
3496 KB |
Output is correct |
13 |
Correct |
113 ms |
27860 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
3 ms |
860 KB |
Output is correct |
17 |
Correct |
58 ms |
10252 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
29 ms |
8256 KB |
Output is correct |
21 |
Correct |
116 ms |
27984 KB |
Output is correct |
22 |
Correct |
112 ms |
27988 KB |
Output is correct |
23 |
Correct |
123 ms |
27988 KB |
Output is correct |
24 |
Correct |
120 ms |
27988 KB |
Output is correct |
25 |
Correct |
50 ms |
13236 KB |
Output is correct |
26 |
Correct |
46 ms |
12372 KB |
Output is correct |
27 |
Correct |
117 ms |
27920 KB |
Output is correct |
28 |
Correct |
113 ms |
28084 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
31 |
Correct |
0 ms |
348 KB |
Output is correct |
32 |
Correct |
0 ms |
344 KB |
Output is correct |
33 |
Incorrect |
1 ms |
348 KB |
Answer gives possible 0 while actual possible 1 |
34 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 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 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
6 ms |
3420 KB |
Output is correct |
7 |
Correct |
128 ms |
27920 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 |
344 KB |
Output is correct |
12 |
Correct |
5 ms |
3496 KB |
Output is correct |
13 |
Correct |
113 ms |
27860 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
3 ms |
860 KB |
Output is correct |
17 |
Correct |
58 ms |
10252 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
29 ms |
8256 KB |
Output is correct |
21 |
Correct |
116 ms |
27984 KB |
Output is correct |
22 |
Correct |
112 ms |
27988 KB |
Output is correct |
23 |
Correct |
123 ms |
27988 KB |
Output is correct |
24 |
Correct |
120 ms |
27988 KB |
Output is correct |
25 |
Correct |
50 ms |
13236 KB |
Output is correct |
26 |
Correct |
46 ms |
12372 KB |
Output is correct |
27 |
Correct |
117 ms |
27920 KB |
Output is correct |
28 |
Correct |
113 ms |
28084 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
348 KB |
Output is correct |
31 |
Correct |
0 ms |
348 KB |
Output is correct |
32 |
Correct |
0 ms |
344 KB |
Output is correct |
33 |
Incorrect |
1 ms |
348 KB |
Answer gives possible 0 while actual possible 1 |
34 |
Halted |
0 ms |
0 KB |
- |