#include <bits/stdc++.h>
#include "soccer.h"
#define ar array
#define ll long long
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using namespace std;
template<typename T> bool ckmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> bool ckmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
const int nax = 31;
int dp[nax][nax][nax][nax];
int biggest_stadium(int n, std::vector<std::vector<int>> F)
{
memset(dp, 0xc0, sizeof(dp));
vector<vector<int>> to(n, vector<int>(n, -1));
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) if (!F[i][j]) {
int r = j;
while (r+1 < n && !F[i][r+1]) r++;
for (int k = j; k <= r; k++) to[i][k] = r;
dp[i][i][j][r] = r-j+1;
j = r;
}
}
for (int len = 1; len < n; len++) {
for (int i = 0; i+len-1 < n; i++) {
int j = i+len-1;
for (int l = 0; l < n; l++) {
for (int r = l; r < n; r++) if (dp[i][j][l][r] > 0) {
if (i) {
for (int z = l; z <= r; z++) if (~to[i-1][z]) {
int new_r = min(to[i-1][z], r);
ckmax(dp[i-1][j][z][new_r], dp[i][j][l][r] + new_r - z + 1);
}
}
if (j+1 < n) {
for (int z = l; z <= r; z++) if (~to[j+1][z]) {
int new_r = min(to[j+1][z], r);
ckmax(dp[i][j+1][z][new_r], dp[i][j][l][r] + new_r - z + 1);
}
}
}
}
}
}
int ans = 0;
for (int i = 0; i < n; i++) for (int j = i; j < n; j++) for (int k = 0; k < n; k++) for (int l = k; l < n; l++) ckmax(ans, dp[i][j][k][l]);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3932 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3932 KB |
ok |
2 |
Correct |
1 ms |
3932 KB |
ok |
3 |
Correct |
1 ms |
3932 KB |
ok |
4 |
Correct |
2 ms |
3932 KB |
ok |
5 |
Correct |
2 ms |
3932 KB |
ok |
6 |
Correct |
2 ms |
3932 KB |
ok |
7 |
Runtime error |
6 ms |
8024 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3932 KB |
ok |
2 |
Correct |
1 ms |
3932 KB |
ok |
3 |
Correct |
2 ms |
3932 KB |
ok |
4 |
Correct |
1 ms |
3932 KB |
ok |
5 |
Correct |
1 ms |
3932 KB |
ok |
6 |
Correct |
1 ms |
3932 KB |
ok |
7 |
Correct |
2 ms |
3944 KB |
ok |
8 |
Correct |
2 ms |
3932 KB |
ok |
9 |
Correct |
1 ms |
4024 KB |
ok |
10 |
Correct |
2 ms |
3932 KB |
ok |
11 |
Correct |
2 ms |
3932 KB |
ok |
12 |
Correct |
1 ms |
4028 KB |
ok |
13 |
Correct |
1 ms |
3932 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3932 KB |
ok |
2 |
Correct |
2 ms |
3932 KB |
ok |
3 |
Correct |
1 ms |
3932 KB |
ok |
4 |
Correct |
2 ms |
3932 KB |
ok |
5 |
Correct |
1 ms |
3932 KB |
ok |
6 |
Correct |
1 ms |
3932 KB |
ok |
7 |
Correct |
1 ms |
3932 KB |
ok |
8 |
Correct |
2 ms |
3944 KB |
ok |
9 |
Correct |
2 ms |
3932 KB |
ok |
10 |
Correct |
1 ms |
4024 KB |
ok |
11 |
Correct |
2 ms |
3932 KB |
ok |
12 |
Correct |
2 ms |
3932 KB |
ok |
13 |
Correct |
1 ms |
4028 KB |
ok |
14 |
Correct |
1 ms |
3932 KB |
ok |
15 |
Correct |
2 ms |
3928 KB |
ok |
16 |
Correct |
2 ms |
3932 KB |
ok |
17 |
Correct |
2 ms |
3948 KB |
ok |
18 |
Correct |
1 ms |
3932 KB |
ok |
19 |
Correct |
2 ms |
3932 KB |
ok |
20 |
Correct |
1 ms |
3932 KB |
ok |
21 |
Correct |
3 ms |
3932 KB |
ok |
22 |
Correct |
1 ms |
3932 KB |
ok |
23 |
Correct |
1 ms |
3932 KB |
ok |
24 |
Correct |
2 ms |
3928 KB |
ok |
25 |
Correct |
2 ms |
3932 KB |
ok |
26 |
Correct |
1 ms |
3932 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3932 KB |
ok |
2 |
Correct |
2 ms |
3932 KB |
ok |
3 |
Correct |
1 ms |
3932 KB |
ok |
4 |
Correct |
1 ms |
3932 KB |
ok |
5 |
Correct |
2 ms |
3932 KB |
ok |
6 |
Correct |
2 ms |
3932 KB |
ok |
7 |
Correct |
1 ms |
3932 KB |
ok |
8 |
Correct |
1 ms |
3932 KB |
ok |
9 |
Correct |
1 ms |
3932 KB |
ok |
10 |
Correct |
2 ms |
3944 KB |
ok |
11 |
Correct |
2 ms |
3932 KB |
ok |
12 |
Correct |
1 ms |
4024 KB |
ok |
13 |
Correct |
2 ms |
3932 KB |
ok |
14 |
Correct |
2 ms |
3932 KB |
ok |
15 |
Correct |
1 ms |
4028 KB |
ok |
16 |
Correct |
1 ms |
3932 KB |
ok |
17 |
Correct |
2 ms |
3928 KB |
ok |
18 |
Correct |
2 ms |
3932 KB |
ok |
19 |
Correct |
2 ms |
3948 KB |
ok |
20 |
Correct |
1 ms |
3932 KB |
ok |
21 |
Correct |
2 ms |
3932 KB |
ok |
22 |
Correct |
1 ms |
3932 KB |
ok |
23 |
Correct |
3 ms |
3932 KB |
ok |
24 |
Correct |
1 ms |
3932 KB |
ok |
25 |
Correct |
1 ms |
3932 KB |
ok |
26 |
Correct |
2 ms |
3928 KB |
ok |
27 |
Correct |
2 ms |
3932 KB |
ok |
28 |
Correct |
1 ms |
3932 KB |
ok |
29 |
Correct |
2 ms |
3932 KB |
ok |
30 |
Correct |
2 ms |
4060 KB |
ok |
31 |
Correct |
2 ms |
3932 KB |
ok |
32 |
Correct |
2 ms |
4064 KB |
ok |
33 |
Correct |
2 ms |
3932 KB |
ok |
34 |
Correct |
2 ms |
3936 KB |
ok |
35 |
Correct |
2 ms |
3928 KB |
ok |
36 |
Correct |
2 ms |
3932 KB |
ok |
37 |
Correct |
2 ms |
3932 KB |
ok |
38 |
Correct |
2 ms |
3932 KB |
ok |
39 |
Correct |
2 ms |
3932 KB |
ok |
40 |
Correct |
2 ms |
4064 KB |
ok |
41 |
Correct |
2 ms |
3932 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3932 KB |
ok |
2 |
Correct |
2 ms |
3932 KB |
ok |
3 |
Correct |
1 ms |
3932 KB |
ok |
4 |
Correct |
1 ms |
3932 KB |
ok |
5 |
Correct |
2 ms |
3932 KB |
ok |
6 |
Correct |
2 ms |
3932 KB |
ok |
7 |
Correct |
1 ms |
3932 KB |
ok |
8 |
Correct |
1 ms |
3932 KB |
ok |
9 |
Correct |
1 ms |
3932 KB |
ok |
10 |
Correct |
2 ms |
3944 KB |
ok |
11 |
Correct |
2 ms |
3932 KB |
ok |
12 |
Correct |
1 ms |
4024 KB |
ok |
13 |
Correct |
2 ms |
3932 KB |
ok |
14 |
Correct |
2 ms |
3932 KB |
ok |
15 |
Correct |
1 ms |
4028 KB |
ok |
16 |
Correct |
1 ms |
3932 KB |
ok |
17 |
Correct |
2 ms |
3928 KB |
ok |
18 |
Correct |
2 ms |
3932 KB |
ok |
19 |
Correct |
2 ms |
3948 KB |
ok |
20 |
Correct |
1 ms |
3932 KB |
ok |
21 |
Correct |
2 ms |
3932 KB |
ok |
22 |
Correct |
1 ms |
3932 KB |
ok |
23 |
Correct |
3 ms |
3932 KB |
ok |
24 |
Correct |
1 ms |
3932 KB |
ok |
25 |
Correct |
1 ms |
3932 KB |
ok |
26 |
Correct |
2 ms |
3928 KB |
ok |
27 |
Correct |
2 ms |
3932 KB |
ok |
28 |
Correct |
1 ms |
3932 KB |
ok |
29 |
Correct |
2 ms |
3932 KB |
ok |
30 |
Correct |
2 ms |
4060 KB |
ok |
31 |
Correct |
2 ms |
3932 KB |
ok |
32 |
Correct |
2 ms |
4064 KB |
ok |
33 |
Correct |
2 ms |
3932 KB |
ok |
34 |
Correct |
2 ms |
3936 KB |
ok |
35 |
Correct |
2 ms |
3928 KB |
ok |
36 |
Correct |
2 ms |
3932 KB |
ok |
37 |
Correct |
2 ms |
3932 KB |
ok |
38 |
Correct |
2 ms |
3932 KB |
ok |
39 |
Correct |
2 ms |
3932 KB |
ok |
40 |
Correct |
2 ms |
4064 KB |
ok |
41 |
Correct |
2 ms |
3932 KB |
ok |
42 |
Runtime error |
19 ms |
14428 KB |
Execution killed with signal 11 |
43 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3932 KB |
ok |
2 |
Correct |
2 ms |
3932 KB |
ok |
3 |
Correct |
1 ms |
3932 KB |
ok |
4 |
Correct |
1 ms |
3932 KB |
ok |
5 |
Correct |
2 ms |
3932 KB |
ok |
6 |
Correct |
2 ms |
3932 KB |
ok |
7 |
Correct |
2 ms |
3932 KB |
ok |
8 |
Runtime error |
6 ms |
8024 KB |
Execution killed with signal 11 |
9 |
Halted |
0 ms |
0 KB |
- |