#include <bits/stdc++.h>
using namespace std;
#include "supertrees.h"
int n, par[1005];
int find(int u){
if(par[u] == u) return u;
par[u] = find(par[u]);
return par[u];
}
void union_(int u, int v){
par[find(u)] = find(v);
}
int construct(vector<vector<int> > p){
n = p.size();
for(int i = 0; i < n; i++) par[i] = i;
vector<vector<int> > b(n, vector<int>(n));
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
if(p[i][j] && find(i) != find(j)){
union_(i, j);
b[i][j] = b[j][i] = 1;
}else if(!p[i][j] && find(i) == find(j)) return 0;
}
}
build(b);
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 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 |
7 ms |
1116 KB |
Output is correct |
7 |
Correct |
154 ms |
22040 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 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 |
7 ms |
1116 KB |
Output is correct |
7 |
Correct |
154 ms |
22040 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 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 |
8 ms |
1368 KB |
Output is correct |
13 |
Correct |
158 ms |
23900 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
3 ms |
860 KB |
Output is correct |
17 |
Correct |
71 ms |
14092 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
40 ms |
6176 KB |
Output is correct |
21 |
Correct |
169 ms |
24156 KB |
Output is correct |
22 |
Correct |
157 ms |
23892 KB |
Output is correct |
23 |
Correct |
158 ms |
23892 KB |
Output is correct |
24 |
Correct |
164 ms |
23888 KB |
Output is correct |
25 |
Correct |
66 ms |
14220 KB |
Output is correct |
26 |
Correct |
72 ms |
14080 KB |
Output is correct |
27 |
Correct |
159 ms |
23948 KB |
Output is correct |
28 |
Correct |
167 ms |
24148 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 |
Incorrect |
1 ms |
512 KB |
Answer gives possible 1 while actual possible 0 |
5 |
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 |
Too few ways to get from 0 to 1, should be 2 found 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 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 |
7 ms |
1116 KB |
Output is correct |
7 |
Correct |
154 ms |
22040 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 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 |
8 ms |
1368 KB |
Output is correct |
13 |
Correct |
158 ms |
23900 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
3 ms |
860 KB |
Output is correct |
17 |
Correct |
71 ms |
14092 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
40 ms |
6176 KB |
Output is correct |
21 |
Correct |
169 ms |
24156 KB |
Output is correct |
22 |
Correct |
157 ms |
23892 KB |
Output is correct |
23 |
Correct |
158 ms |
23892 KB |
Output is correct |
24 |
Correct |
164 ms |
23888 KB |
Output is correct |
25 |
Correct |
66 ms |
14220 KB |
Output is correct |
26 |
Correct |
72 ms |
14080 KB |
Output is correct |
27 |
Correct |
159 ms |
23948 KB |
Output is correct |
28 |
Correct |
167 ms |
24148 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 |
Incorrect |
1 ms |
512 KB |
Answer gives possible 1 while actual possible 0 |
33 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 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 |
7 ms |
1116 KB |
Output is correct |
7 |
Correct |
154 ms |
22040 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 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 |
8 ms |
1368 KB |
Output is correct |
13 |
Correct |
158 ms |
23900 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
3 ms |
860 KB |
Output is correct |
17 |
Correct |
71 ms |
14092 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
40 ms |
6176 KB |
Output is correct |
21 |
Correct |
169 ms |
24156 KB |
Output is correct |
22 |
Correct |
157 ms |
23892 KB |
Output is correct |
23 |
Correct |
158 ms |
23892 KB |
Output is correct |
24 |
Correct |
164 ms |
23888 KB |
Output is correct |
25 |
Correct |
66 ms |
14220 KB |
Output is correct |
26 |
Correct |
72 ms |
14080 KB |
Output is correct |
27 |
Correct |
159 ms |
23948 KB |
Output is correct |
28 |
Correct |
167 ms |
24148 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 |
Incorrect |
1 ms |
512 KB |
Answer gives possible 1 while actual possible 0 |
33 |
Halted |
0 ms |
0 KB |
- |