#include "soccer.h"
#include <bits/stdc++.h>
using namespace std;
const int mxn=32,inf=1e9;
int n,ans,dp[mxn][mxn][mxn][mxn],s[2001][2001];
int sum(int l, int r, int i){
return s[r][i]-(l?s[l-1][i]:0);
}
int f(int i, int j, int l, int r){
if (i==j)
return 0;
if (dp[i][j][l][r]!=-1)
return dp[i][j][l][r];
dp[i][j][l][r]=max(f(i+1,j,l,r),f(i,j-1,l,r));
if (l&&!sum(i,j,l-1))
dp[i][j][l][r]=max(dp[i][j][l][r],f(i,j,l-1,r)+j-i+1);
if (r<n&&!sum(i,j,r))
dp[i][j][l][r]=max(dp[i][j][l][r],f(i,j,l,r+1)+j-i+1);
return dp[i][j][l][r];
}
int biggest_stadium(int N, vector <vector <int>> F){
n=N;
for (int i=0;i<N;i++)
for (int j=0;j<N;j++)
s[i][j]=(i?s[i-1][j]:0)+F[i][j];
memset(dp,-1,sizeof(dp));
for (int i=0;i<=n;i++)
ans=max(ans,f(0,n-1,i,i));
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
5464 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
5468 KB |
ok |
2 |
Correct |
1 ms |
5720 KB |
ok |
3 |
Correct |
1 ms |
5492 KB |
ok |
4 |
Correct |
1 ms |
5468 KB |
ok |
5 |
Incorrect |
1 ms |
5564 KB |
wrong |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
5468 KB |
ok |
2 |
Correct |
1 ms |
5720 KB |
ok |
3 |
Partially correct |
1 ms |
5464 KB |
partial |
4 |
Partially correct |
1 ms |
5464 KB |
partial |
5 |
Partially correct |
1 ms |
5468 KB |
partial |
6 |
Partially correct |
1 ms |
5464 KB |
partial |
7 |
Partially correct |
2 ms |
5724 KB |
partial |
8 |
Incorrect |
1 ms |
5560 KB |
wrong |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
5464 KB |
ok |
2 |
Correct |
1 ms |
5468 KB |
ok |
3 |
Correct |
1 ms |
5720 KB |
ok |
4 |
Partially correct |
1 ms |
5464 KB |
partial |
5 |
Partially correct |
1 ms |
5464 KB |
partial |
6 |
Partially correct |
1 ms |
5468 KB |
partial |
7 |
Partially correct |
1 ms |
5464 KB |
partial |
8 |
Partially correct |
2 ms |
5724 KB |
partial |
9 |
Incorrect |
1 ms |
5560 KB |
wrong |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
5464 KB |
ok |
2 |
Correct |
1 ms |
5468 KB |
ok |
3 |
Correct |
1 ms |
5720 KB |
ok |
4 |
Correct |
1 ms |
5492 KB |
ok |
5 |
Correct |
1 ms |
5468 KB |
ok |
6 |
Partially correct |
1 ms |
5464 KB |
partial |
7 |
Partially correct |
1 ms |
5464 KB |
partial |
8 |
Partially correct |
1 ms |
5468 KB |
partial |
9 |
Partially correct |
1 ms |
5464 KB |
partial |
10 |
Partially correct |
2 ms |
5724 KB |
partial |
11 |
Incorrect |
1 ms |
5560 KB |
wrong |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
5464 KB |
ok |
2 |
Correct |
1 ms |
5468 KB |
ok |
3 |
Correct |
1 ms |
5720 KB |
ok |
4 |
Correct |
1 ms |
5492 KB |
ok |
5 |
Correct |
1 ms |
5468 KB |
ok |
6 |
Partially correct |
1 ms |
5464 KB |
partial |
7 |
Partially correct |
1 ms |
5464 KB |
partial |
8 |
Partially correct |
1 ms |
5468 KB |
partial |
9 |
Partially correct |
1 ms |
5464 KB |
partial |
10 |
Partially correct |
2 ms |
5724 KB |
partial |
11 |
Incorrect |
1 ms |
5560 KB |
wrong |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
5464 KB |
ok |
2 |
Correct |
1 ms |
5468 KB |
ok |
3 |
Correct |
1 ms |
5720 KB |
ok |
4 |
Correct |
1 ms |
5492 KB |
ok |
5 |
Correct |
1 ms |
5468 KB |
ok |
6 |
Incorrect |
1 ms |
5564 KB |
wrong |
7 |
Halted |
0 ms |
0 KB |
- |