#include <bits/stdc++.h>
#include "supertrees.h"
using namespace std;
#define N 100005
#define wr cout << "Continue debugging\n";
#define all(x) (x).begin(), (x).end()
#define ll long long int
#define pii pair <int, int>
#define pb push_back
#define ff first
#define ss second
vector<int> vec[N];
int construct(vector<vector<int>> p){
int n = p.size();
vector<vector<int>> b(n, vector<int>(n, 0));
vector<int> vis(n, 0);
int cnt = 0;
for (int i = 0; i < n; i++){
if (!vis[i]) vis[i] = ++cnt;
for (int j = 0; j < n; j++){
if (p[i][j] and i != j) vis[j] = vis[i];
else if (!p[i][j]) vec[vis[i]].pb(j);
}
}
for (int i = 0; i < n; i++){
for (auto j : vec[vis[i]]){
if (p[i][j]) return 0;
}
}
vector<int> chk(n+1, 0);
for (int i = 0; i < n; i++){
if (chk[vis[i]]++) continue;
for (int j = 0; j < n; j++){
if (p[i][j] and i != j) b[i][j] = b[j][i] = 1;
}
}
// for (int i = 0; i < n; i++){
// for (int j = 0; j < n; j++) cout << b[i][j] << ' ';
// cout << '\n';
// }
build(b);
return 1;
}
// int main ()
// {
// int n;
// cin >> n;
// vector<vector<int>> p(n, vector<int>(n));
// for (int i = 0; i < n; i++){
// for (int j = 0; j < n; j++) cin >> p[i][j];
// }
// int x = construct(p);
// }
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2644 KB |
Output is correct |
2 |
Correct |
1 ms |
2644 KB |
Output is correct |
3 |
Correct |
1 ms |
2644 KB |
Output is correct |
4 |
Correct |
1 ms |
2644 KB |
Output is correct |
5 |
Correct |
1 ms |
2644 KB |
Output is correct |
6 |
Correct |
7 ms |
3540 KB |
Output is correct |
7 |
Correct |
149 ms |
24372 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2644 KB |
Output is correct |
2 |
Correct |
1 ms |
2644 KB |
Output is correct |
3 |
Correct |
1 ms |
2644 KB |
Output is correct |
4 |
Correct |
1 ms |
2644 KB |
Output is correct |
5 |
Correct |
1 ms |
2644 KB |
Output is correct |
6 |
Correct |
7 ms |
3540 KB |
Output is correct |
7 |
Correct |
149 ms |
24372 KB |
Output is correct |
8 |
Correct |
1 ms |
2644 KB |
Output is correct |
9 |
Correct |
1 ms |
2644 KB |
Output is correct |
10 |
Correct |
1 ms |
2644 KB |
Output is correct |
11 |
Correct |
1 ms |
2644 KB |
Output is correct |
12 |
Correct |
7 ms |
3668 KB |
Output is correct |
13 |
Correct |
165 ms |
28404 KB |
Output is correct |
14 |
Correct |
1 ms |
2644 KB |
Output is correct |
15 |
Correct |
1 ms |
2644 KB |
Output is correct |
16 |
Correct |
4 ms |
3284 KB |
Output is correct |
17 |
Correct |
72 ms |
16588 KB |
Output is correct |
18 |
Correct |
1 ms |
2644 KB |
Output is correct |
19 |
Correct |
1 ms |
2644 KB |
Output is correct |
20 |
Correct |
42 ms |
9792 KB |
Output is correct |
21 |
Correct |
201 ms |
29820 KB |
Output is correct |
22 |
Correct |
157 ms |
30768 KB |
Output is correct |
23 |
Correct |
276 ms |
28276 KB |
Output is correct |
24 |
Correct |
158 ms |
30384 KB |
Output is correct |
25 |
Correct |
105 ms |
20332 KB |
Output is correct |
26 |
Correct |
70 ms |
21168 KB |
Output is correct |
27 |
Correct |
270 ms |
28324 KB |
Output is correct |
28 |
Correct |
160 ms |
30284 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2644 KB |
Output is correct |
2 |
Correct |
1 ms |
2644 KB |
Output is correct |
3 |
Correct |
1 ms |
2644 KB |
Output is correct |
4 |
Incorrect |
1 ms |
2644 KB |
Answer gives possible 1 while actual possible 0 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2644 KB |
Output is correct |
2 |
Incorrect |
1 ms |
2644 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 |
2644 KB |
Output is correct |
2 |
Correct |
1 ms |
2644 KB |
Output is correct |
3 |
Correct |
1 ms |
2644 KB |
Output is correct |
4 |
Correct |
1 ms |
2644 KB |
Output is correct |
5 |
Correct |
1 ms |
2644 KB |
Output is correct |
6 |
Correct |
7 ms |
3540 KB |
Output is correct |
7 |
Correct |
149 ms |
24372 KB |
Output is correct |
8 |
Correct |
1 ms |
2644 KB |
Output is correct |
9 |
Correct |
1 ms |
2644 KB |
Output is correct |
10 |
Correct |
1 ms |
2644 KB |
Output is correct |
11 |
Correct |
1 ms |
2644 KB |
Output is correct |
12 |
Correct |
7 ms |
3668 KB |
Output is correct |
13 |
Correct |
165 ms |
28404 KB |
Output is correct |
14 |
Correct |
1 ms |
2644 KB |
Output is correct |
15 |
Correct |
1 ms |
2644 KB |
Output is correct |
16 |
Correct |
4 ms |
3284 KB |
Output is correct |
17 |
Correct |
72 ms |
16588 KB |
Output is correct |
18 |
Correct |
1 ms |
2644 KB |
Output is correct |
19 |
Correct |
1 ms |
2644 KB |
Output is correct |
20 |
Correct |
42 ms |
9792 KB |
Output is correct |
21 |
Correct |
201 ms |
29820 KB |
Output is correct |
22 |
Correct |
157 ms |
30768 KB |
Output is correct |
23 |
Correct |
276 ms |
28276 KB |
Output is correct |
24 |
Correct |
158 ms |
30384 KB |
Output is correct |
25 |
Correct |
105 ms |
20332 KB |
Output is correct |
26 |
Correct |
70 ms |
21168 KB |
Output is correct |
27 |
Correct |
270 ms |
28324 KB |
Output is correct |
28 |
Correct |
160 ms |
30284 KB |
Output is correct |
29 |
Correct |
1 ms |
2644 KB |
Output is correct |
30 |
Correct |
1 ms |
2644 KB |
Output is correct |
31 |
Correct |
1 ms |
2644 KB |
Output is correct |
32 |
Incorrect |
1 ms |
2644 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 |
2644 KB |
Output is correct |
2 |
Correct |
1 ms |
2644 KB |
Output is correct |
3 |
Correct |
1 ms |
2644 KB |
Output is correct |
4 |
Correct |
1 ms |
2644 KB |
Output is correct |
5 |
Correct |
1 ms |
2644 KB |
Output is correct |
6 |
Correct |
7 ms |
3540 KB |
Output is correct |
7 |
Correct |
149 ms |
24372 KB |
Output is correct |
8 |
Correct |
1 ms |
2644 KB |
Output is correct |
9 |
Correct |
1 ms |
2644 KB |
Output is correct |
10 |
Correct |
1 ms |
2644 KB |
Output is correct |
11 |
Correct |
1 ms |
2644 KB |
Output is correct |
12 |
Correct |
7 ms |
3668 KB |
Output is correct |
13 |
Correct |
165 ms |
28404 KB |
Output is correct |
14 |
Correct |
1 ms |
2644 KB |
Output is correct |
15 |
Correct |
1 ms |
2644 KB |
Output is correct |
16 |
Correct |
4 ms |
3284 KB |
Output is correct |
17 |
Correct |
72 ms |
16588 KB |
Output is correct |
18 |
Correct |
1 ms |
2644 KB |
Output is correct |
19 |
Correct |
1 ms |
2644 KB |
Output is correct |
20 |
Correct |
42 ms |
9792 KB |
Output is correct |
21 |
Correct |
201 ms |
29820 KB |
Output is correct |
22 |
Correct |
157 ms |
30768 KB |
Output is correct |
23 |
Correct |
276 ms |
28276 KB |
Output is correct |
24 |
Correct |
158 ms |
30384 KB |
Output is correct |
25 |
Correct |
105 ms |
20332 KB |
Output is correct |
26 |
Correct |
70 ms |
21168 KB |
Output is correct |
27 |
Correct |
270 ms |
28324 KB |
Output is correct |
28 |
Correct |
160 ms |
30284 KB |
Output is correct |
29 |
Correct |
1 ms |
2644 KB |
Output is correct |
30 |
Correct |
1 ms |
2644 KB |
Output is correct |
31 |
Correct |
1 ms |
2644 KB |
Output is correct |
32 |
Incorrect |
1 ms |
2644 KB |
Answer gives possible 1 while actual possible 0 |
33 |
Halted |
0 ms |
0 KB |
- |