#include "supertrees.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
#define sep ' '
#define debug(x) cerr << #x << ": " << x << endl;
int f[MAXN], sz[MAXN], L[MAXN];
int construct(vector<vector<int>> p) {
int n = p.size();
vector<vector<int>> answer;
for (int i = 0; i < n; i++) {
vector<int> row;
row.resize(n, 0);
answer.push_back(row);
}
sz[0] = 1;
for (int i = 1; i < n; i++) {
int lst = i;
for (int j = 0; j < i; j++)
if (p[i][j])
lst = j;
f[i] = i;
f[i] = f[lst];
L[f[i]] = i;
sz[f[i]]++;
if (lst < i) answer[i][lst] = answer[lst][i] = 1;
}
for (int i = 0; i < n; i++)
for (int j = i + 1; j < n; j++)
if ((p[i][j] > 0) ^ (f[i] == f[j]))
return 0;
for (int i = 0; i < n; i++) {
if (sz[i] == 2)
return 0;
if (sz[i] > 2)
answer[L[i]][i] = answer[i][L[i]] = 1;
}
build(answer);
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Answer gives possible 0 while actual possible 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Answer gives possible 0 while actual possible 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
308 KB |
Output is correct |
8 |
Correct |
7 ms |
1236 KB |
Output is correct |
9 |
Correct |
173 ms |
23944 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
7 ms |
1216 KB |
Output is correct |
13 |
Correct |
184 ms |
24036 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
4 ms |
852 KB |
Output is correct |
17 |
Correct |
87 ms |
14088 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
0 ms |
304 KB |
Output is correct |
21 |
Correct |
39 ms |
6268 KB |
Output is correct |
22 |
Correct |
177 ms |
23984 KB |
Output is correct |
23 |
Correct |
160 ms |
23932 KB |
Output is correct |
24 |
Correct |
157 ms |
23964 KB |
Output is correct |
25 |
Correct |
67 ms |
14072 KB |
Output is correct |
26 |
Correct |
88 ms |
14076 KB |
Output is correct |
27 |
Correct |
150 ms |
23964 KB |
Output is correct |
28 |
Correct |
159 ms |
23936 KB |
Output is correct |
29 |
Correct |
66 ms |
14072 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
308 KB |
Too many ways to get from 1 to 4, should be 1 found no less than 2 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Answer gives possible 0 while actual possible 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Answer gives possible 0 while actual possible 1 |
3 |
Halted |
0 ms |
0 KB |
- |