#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define replr(i, a, b) for (int i = int(a); i <= int(b); ++i)
#define reprl(i, a, b) for (int i = int(a); i >= int(b); --i)
#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define mkp(a, b) make_pair(a, b)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VPI;
typedef vector<VI> VVI;
typedef vector<VVI> VVVI;
typedef vector<VPI> VVPI;
typedef pair<ll, ll> PLL;
typedef vector<ll> VL;
typedef vector<PLL> VPL;
typedef vector<VL> VVL;
typedef vector<VVL> VVVL;
typedef vector<VPL> VVPL;
template<class T> T setmax(T& a, T b) {if (a < b) return a = b; return a;}
template<class T> T setmin(T& a, T b) {if (a < b) return a; return a = b;}
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T>
using indset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#include "supertrees.h"
int n;
VVI p;
VVI comps() {
VVI s = p;
sort(all(s));
VVI ret;
for (int i = 0; i < n; i++) {
if (i == 0 || s[i] != s[i-1]) {
if (i) rep(j, n) {
if (s[i][j] && s[i-1][j]) {
return VVI();
}
}
ret.pb(VI());
rep(j, n) if (s[i][j]) ret.back().pb(j);
}
}
return ret;
}
int construct(VVI P_ARG) {
p = P_ARG;
n = p.size();
VVI comp = comps();
if (comp.size() == 0) return 0;
VVI ans(n, VI(n));
for (VI vec : comp) {
replr(i, 1, vec.size()-1) {
ans[vec[0]][vec[i]] = true;
ans[vec[i]][vec[0]] = true;
}
}
build(ans);
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 |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
436 KB |
Output is correct |
6 |
Correct |
4 ms |
1372 KB |
Output is correct |
7 |
Correct |
105 ms |
28072 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 |
436 KB |
Output is correct |
6 |
Correct |
4 ms |
1372 KB |
Output is correct |
7 |
Correct |
105 ms |
28072 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
432 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
6 ms |
1360 KB |
Output is correct |
13 |
Correct |
99 ms |
27988 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
432 KB |
Output is correct |
16 |
Correct |
3 ms |
1116 KB |
Output is correct |
17 |
Correct |
49 ms |
18032 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
25 ms |
7360 KB |
Output is correct |
21 |
Correct |
113 ms |
27988 KB |
Output is correct |
22 |
Correct |
108 ms |
27988 KB |
Output is correct |
23 |
Correct |
105 ms |
27908 KB |
Output is correct |
24 |
Correct |
144 ms |
27984 KB |
Output is correct |
25 |
Correct |
57 ms |
17920 KB |
Output is correct |
26 |
Correct |
46 ms |
18004 KB |
Output is correct |
27 |
Correct |
109 ms |
28084 KB |
Output is correct |
28 |
Correct |
110 ms |
27996 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
344 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 |
436 KB |
Output is correct |
6 |
Correct |
4 ms |
1372 KB |
Output is correct |
7 |
Correct |
105 ms |
28072 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
432 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
6 ms |
1360 KB |
Output is correct |
13 |
Correct |
99 ms |
27988 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
432 KB |
Output is correct |
16 |
Correct |
3 ms |
1116 KB |
Output is correct |
17 |
Correct |
49 ms |
18032 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
25 ms |
7360 KB |
Output is correct |
21 |
Correct |
113 ms |
27988 KB |
Output is correct |
22 |
Correct |
108 ms |
27988 KB |
Output is correct |
23 |
Correct |
105 ms |
27908 KB |
Output is correct |
24 |
Correct |
144 ms |
27984 KB |
Output is correct |
25 |
Correct |
57 ms |
17920 KB |
Output is correct |
26 |
Correct |
46 ms |
18004 KB |
Output is correct |
27 |
Correct |
109 ms |
28084 KB |
Output is correct |
28 |
Correct |
110 ms |
27996 KB |
Output is correct |
29 |
Correct |
1 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 |
436 KB |
Output is correct |
6 |
Correct |
4 ms |
1372 KB |
Output is correct |
7 |
Correct |
105 ms |
28072 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
432 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
6 ms |
1360 KB |
Output is correct |
13 |
Correct |
99 ms |
27988 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
432 KB |
Output is correct |
16 |
Correct |
3 ms |
1116 KB |
Output is correct |
17 |
Correct |
49 ms |
18032 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
25 ms |
7360 KB |
Output is correct |
21 |
Correct |
113 ms |
27988 KB |
Output is correct |
22 |
Correct |
108 ms |
27988 KB |
Output is correct |
23 |
Correct |
105 ms |
27908 KB |
Output is correct |
24 |
Correct |
144 ms |
27984 KB |
Output is correct |
25 |
Correct |
57 ms |
17920 KB |
Output is correct |
26 |
Correct |
46 ms |
18004 KB |
Output is correct |
27 |
Correct |
109 ms |
28084 KB |
Output is correct |
28 |
Correct |
110 ms |
27996 KB |
Output is correct |
29 |
Correct |
1 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 |
- |