#include "supertrees.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <utility>
#define V vector
#define P pair
#define S second
#define F first
#define pb push_back
#define all(v) v.begin(),v.end()
typedef long long ll;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
static int called = 0;const long long MOD = 1e9+7; // 1e9 + 7
int construct(std::vector<std::vector<int>> p) {
int n =(int) p.size();
V<V<int>>ans(n,V<int>(n,0));
V<int>component(n);
V<bool>visited(n,false);
for(int i=0;i<n;i++){
if(visited[i])continue;
component[i]=i;
for(int j=0;j<n;j++){
if(i==j)continue;
if(p[i][j]) {
if(visited[j])return 0;
visited[j] = true;
component[j] = i;
ans[i][j] = 1;
ans[j][i] = 1;
}
}
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if((component[i]==component[j])!=p[i][j])return 0;
}
}
build(ans);
return 1;
}
Compilation message
supertrees.cpp:16:12: warning: 'called' defined but not used [-Wunused-variable]
16 | static int called = 0;const long long MOD = 1e9+7; // 1e9 + 7
| ^~~~~~
# |
결과 |
실행 시간 |
메모리 |
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 |
4 ms |
1188 KB |
Output is correct |
7 |
Correct |
92 ms |
23344 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 |
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 |
4 ms |
1188 KB |
Output is correct |
7 |
Correct |
92 ms |
23344 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 |
4 ms |
1372 KB |
Output is correct |
13 |
Correct |
96 ms |
23376 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
3 ms |
860 KB |
Output is correct |
17 |
Correct |
47 ms |
13328 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
440 KB |
Output is correct |
20 |
Correct |
28 ms |
6316 KB |
Output is correct |
21 |
Correct |
97 ms |
23380 KB |
Output is correct |
22 |
Correct |
94 ms |
23296 KB |
Output is correct |
23 |
Correct |
111 ms |
23376 KB |
Output is correct |
24 |
Correct |
110 ms |
23320 KB |
Output is correct |
25 |
Correct |
60 ms |
13516 KB |
Output is correct |
26 |
Correct |
43 ms |
13324 KB |
Output is correct |
27 |
Correct |
105 ms |
23284 KB |
Output is correct |
28 |
Correct |
96 ms |
23380 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 |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Incorrect |
0 ms |
348 KB |
Answer gives possible 0 while actual possible 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
4 ms |
1188 KB |
Output is correct |
7 |
Correct |
92 ms |
23344 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 |
4 ms |
1372 KB |
Output is correct |
13 |
Correct |
96 ms |
23376 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
3 ms |
860 KB |
Output is correct |
17 |
Correct |
47 ms |
13328 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
440 KB |
Output is correct |
20 |
Correct |
28 ms |
6316 KB |
Output is correct |
21 |
Correct |
97 ms |
23380 KB |
Output is correct |
22 |
Correct |
94 ms |
23296 KB |
Output is correct |
23 |
Correct |
111 ms |
23376 KB |
Output is correct |
24 |
Correct |
110 ms |
23320 KB |
Output is correct |
25 |
Correct |
60 ms |
13516 KB |
Output is correct |
26 |
Correct |
43 ms |
13324 KB |
Output is correct |
27 |
Correct |
105 ms |
23284 KB |
Output is correct |
28 |
Correct |
96 ms |
23380 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 |
348 KB |
Output is correct |
33 |
Incorrect |
0 ms |
348 KB |
Answer gives possible 0 while actual possible 1 |
34 |
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 |
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 |
4 ms |
1188 KB |
Output is correct |
7 |
Correct |
92 ms |
23344 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 |
4 ms |
1372 KB |
Output is correct |
13 |
Correct |
96 ms |
23376 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
3 ms |
860 KB |
Output is correct |
17 |
Correct |
47 ms |
13328 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
440 KB |
Output is correct |
20 |
Correct |
28 ms |
6316 KB |
Output is correct |
21 |
Correct |
97 ms |
23380 KB |
Output is correct |
22 |
Correct |
94 ms |
23296 KB |
Output is correct |
23 |
Correct |
111 ms |
23376 KB |
Output is correct |
24 |
Correct |
110 ms |
23320 KB |
Output is correct |
25 |
Correct |
60 ms |
13516 KB |
Output is correct |
26 |
Correct |
43 ms |
13324 KB |
Output is correct |
27 |
Correct |
105 ms |
23284 KB |
Output is correct |
28 |
Correct |
96 ms |
23380 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 |
348 KB |
Output is correct |
33 |
Incorrect |
0 ms |
348 KB |
Answer gives possible 0 while actual possible 1 |
34 |
Halted |
0 ms |
0 KB |
- |