#include <bits/stdc++.h>
#include "soccer.h"
using namespace std;
#define pb push_back
#define st first
#define nd second
typedef long long ll;
typedef long double ld;
const ll I = 1000LL * 1000LL * 1000LL * 1000LL * 1000LL * 1000LL;
const int II = 2 * 1000 * 1000 * 1000;
const ll M = 1000LL * 1000LL * 1000LL + 7LL;
const int N = 507;
int tab[N][N];
int dp[2][2][N][N], dpm[2][2][N][N];
int biggest_stadium(int _N, vector<vector<int>> _F)
{
int n = _N;
for(int i = 1; i <= n; ++i)
for(int j = 1; j <= n; ++j)
tab[i][j] = _F[i - 1][j - 1];
int r = 0, ans = 0;
for(int l = 1; l <= n; ++l)
{
int pr = r ^ 1;
for(int i = 1; i <= n; ++i)
for(int j = 1; j <= n; ++j)
{dp[r][0][i][j] = 0; dp[r][1][i][j] = 0;}
for(int i = 1; i <= n; ++i)
for(int j = i; j <= n && tab[j][l] == 0; ++j)
{
dp[r][0][i][j] = dp[pr][0][i][j] + j - i + 1;
dp[r][1][i][j] = max(dp[pr][0][i][j], dp[pr][1][i][j]) + j - i + 1;
ans = max(ans, dp[r][1][i][j]);
}
for(int i = n; i >= 1; --i)
for(int j = i + 1; j <= n; ++j)
dp[r][0][i][j] = max(dp[r][0][i][j], max(dp[r][0][i + 1][j], dp[r][0][i][j - 1]));
for(int i = 1; i <= n; ++i)
for(int j = n; j > i; --j)
dp[r][1][i][j] = max(dp[r][1][i][j], max(dp[r][1][i - 1][j], dp[r][0][i][j + 1]));
r ^= 1;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
6480 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
6480 KB |
ok |
2 |
Correct |
1 ms |
6592 KB |
ok |
3 |
Correct |
2 ms |
6480 KB |
ok |
4 |
Correct |
1 ms |
6480 KB |
ok |
5 |
Correct |
1 ms |
6480 KB |
ok |
6 |
Correct |
2 ms |
6480 KB |
ok |
7 |
Correct |
5 ms |
6480 KB |
ok |
8 |
Correct |
297 ms |
9552 KB |
ok |
9 |
Runtime error |
276 ms |
77640 KB |
Execution killed with signal 11 |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
6480 KB |
ok |
2 |
Correct |
1 ms |
6592 KB |
ok |
3 |
Partially correct |
1 ms |
6480 KB |
partial |
4 |
Partially correct |
2 ms |
6480 KB |
partial |
5 |
Partially correct |
2 ms |
6480 KB |
partial |
6 |
Correct |
1 ms |
6480 KB |
ok |
7 |
Incorrect |
2 ms |
6480 KB |
wrong |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
6480 KB |
ok |
2 |
Correct |
2 ms |
6480 KB |
ok |
3 |
Correct |
1 ms |
6592 KB |
ok |
4 |
Partially correct |
1 ms |
6480 KB |
partial |
5 |
Partially correct |
2 ms |
6480 KB |
partial |
6 |
Partially correct |
2 ms |
6480 KB |
partial |
7 |
Correct |
1 ms |
6480 KB |
ok |
8 |
Incorrect |
2 ms |
6480 KB |
wrong |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
6480 KB |
ok |
2 |
Correct |
2 ms |
6480 KB |
ok |
3 |
Correct |
1 ms |
6592 KB |
ok |
4 |
Correct |
2 ms |
6480 KB |
ok |
5 |
Correct |
1 ms |
6480 KB |
ok |
6 |
Partially correct |
1 ms |
6480 KB |
partial |
7 |
Partially correct |
2 ms |
6480 KB |
partial |
8 |
Partially correct |
2 ms |
6480 KB |
partial |
9 |
Correct |
1 ms |
6480 KB |
ok |
10 |
Incorrect |
2 ms |
6480 KB |
wrong |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
6480 KB |
ok |
2 |
Correct |
2 ms |
6480 KB |
ok |
3 |
Correct |
1 ms |
6592 KB |
ok |
4 |
Correct |
2 ms |
6480 KB |
ok |
5 |
Correct |
1 ms |
6480 KB |
ok |
6 |
Partially correct |
1 ms |
6480 KB |
partial |
7 |
Partially correct |
2 ms |
6480 KB |
partial |
8 |
Partially correct |
2 ms |
6480 KB |
partial |
9 |
Correct |
1 ms |
6480 KB |
ok |
10 |
Incorrect |
2 ms |
6480 KB |
wrong |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
6480 KB |
ok |
2 |
Correct |
2 ms |
6480 KB |
ok |
3 |
Correct |
1 ms |
6592 KB |
ok |
4 |
Correct |
2 ms |
6480 KB |
ok |
5 |
Correct |
1 ms |
6480 KB |
ok |
6 |
Correct |
1 ms |
6480 KB |
ok |
7 |
Correct |
2 ms |
6480 KB |
ok |
8 |
Correct |
5 ms |
6480 KB |
ok |
9 |
Correct |
297 ms |
9552 KB |
ok |
10 |
Runtime error |
276 ms |
77640 KB |
Execution killed with signal 11 |
11 |
Halted |
0 ms |
0 KB |
- |