#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]-s[l][i];
}
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);
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);
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+1][j]=s[i][j]+F[i][j];
memset(dp,-1,sizeof(dp));
for (int i=0;i<=n;i++)
ans=max(ans,f(0,n,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 |
2 ms |
5464 KB |
ok |
2 |
Correct |
1 ms |
5468 KB |
ok |
3 |
Correct |
1 ms |
5468 KB |
ok |
4 |
Correct |
1 ms |
5620 KB |
ok |
5 |
Correct |
1 ms |
5468 KB |
ok |
6 |
Correct |
1 ms |
5468 KB |
ok |
7 |
Runtime error |
9 ms |
15708 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
5464 KB |
ok |
2 |
Correct |
1 ms |
5468 KB |
ok |
3 |
Correct |
2 ms |
5468 KB |
ok |
4 |
Correct |
1 ms |
5468 KB |
ok |
5 |
Correct |
1 ms |
5572 KB |
ok |
6 |
Correct |
1 ms |
5468 KB |
ok |
7 |
Correct |
1 ms |
5468 KB |
ok |
8 |
Correct |
1 ms |
5720 KB |
ok |
9 |
Correct |
1 ms |
5464 KB |
ok |
10 |
Correct |
1 ms |
5468 KB |
ok |
11 |
Correct |
2 ms |
5468 KB |
ok |
12 |
Correct |
2 ms |
5468 KB |
ok |
13 |
Correct |
1 ms |
5468 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
5464 KB |
ok |
2 |
Correct |
2 ms |
5464 KB |
ok |
3 |
Correct |
1 ms |
5468 KB |
ok |
4 |
Correct |
2 ms |
5468 KB |
ok |
5 |
Correct |
1 ms |
5468 KB |
ok |
6 |
Correct |
1 ms |
5572 KB |
ok |
7 |
Correct |
1 ms |
5468 KB |
ok |
8 |
Correct |
1 ms |
5468 KB |
ok |
9 |
Correct |
1 ms |
5720 KB |
ok |
10 |
Correct |
1 ms |
5464 KB |
ok |
11 |
Correct |
1 ms |
5468 KB |
ok |
12 |
Correct |
2 ms |
5468 KB |
ok |
13 |
Correct |
2 ms |
5468 KB |
ok |
14 |
Correct |
1 ms |
5468 KB |
ok |
15 |
Correct |
2 ms |
5464 KB |
ok |
16 |
Correct |
1 ms |
5468 KB |
ok |
17 |
Correct |
1 ms |
5468 KB |
ok |
18 |
Correct |
1 ms |
5468 KB |
ok |
19 |
Correct |
2 ms |
5468 KB |
ok |
20 |
Correct |
1 ms |
5468 KB |
ok |
21 |
Correct |
1 ms |
5468 KB |
ok |
22 |
Correct |
1 ms |
5468 KB |
ok |
23 |
Correct |
1 ms |
5468 KB |
ok |
24 |
Correct |
1 ms |
5468 KB |
ok |
25 |
Correct |
1 ms |
5468 KB |
ok |
26 |
Correct |
1 ms |
5464 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
5464 KB |
ok |
2 |
Correct |
2 ms |
5464 KB |
ok |
3 |
Correct |
1 ms |
5468 KB |
ok |
4 |
Correct |
1 ms |
5468 KB |
ok |
5 |
Correct |
1 ms |
5620 KB |
ok |
6 |
Correct |
2 ms |
5468 KB |
ok |
7 |
Correct |
1 ms |
5468 KB |
ok |
8 |
Correct |
1 ms |
5572 KB |
ok |
9 |
Correct |
1 ms |
5468 KB |
ok |
10 |
Correct |
1 ms |
5468 KB |
ok |
11 |
Correct |
1 ms |
5720 KB |
ok |
12 |
Correct |
1 ms |
5464 KB |
ok |
13 |
Correct |
1 ms |
5468 KB |
ok |
14 |
Correct |
2 ms |
5468 KB |
ok |
15 |
Correct |
2 ms |
5468 KB |
ok |
16 |
Correct |
1 ms |
5468 KB |
ok |
17 |
Correct |
2 ms |
5464 KB |
ok |
18 |
Correct |
1 ms |
5468 KB |
ok |
19 |
Correct |
1 ms |
5468 KB |
ok |
20 |
Correct |
1 ms |
5468 KB |
ok |
21 |
Correct |
2 ms |
5468 KB |
ok |
22 |
Correct |
1 ms |
5468 KB |
ok |
23 |
Correct |
1 ms |
5468 KB |
ok |
24 |
Correct |
1 ms |
5468 KB |
ok |
25 |
Correct |
1 ms |
5468 KB |
ok |
26 |
Correct |
1 ms |
5468 KB |
ok |
27 |
Correct |
1 ms |
5468 KB |
ok |
28 |
Correct |
1 ms |
5464 KB |
ok |
29 |
Correct |
1 ms |
5464 KB |
ok |
30 |
Correct |
2 ms |
7772 KB |
ok |
31 |
Correct |
2 ms |
7772 KB |
ok |
32 |
Correct |
2 ms |
7580 KB |
ok |
33 |
Correct |
2 ms |
7772 KB |
ok |
34 |
Correct |
2 ms |
7772 KB |
ok |
35 |
Correct |
2 ms |
7772 KB |
ok |
36 |
Correct |
2 ms |
7772 KB |
ok |
37 |
Correct |
2 ms |
7772 KB |
ok |
38 |
Correct |
2 ms |
7772 KB |
ok |
39 |
Correct |
2 ms |
7772 KB |
ok |
40 |
Correct |
3 ms |
7772 KB |
ok |
41 |
Correct |
3 ms |
7772 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
5464 KB |
ok |
2 |
Correct |
2 ms |
5464 KB |
ok |
3 |
Correct |
1 ms |
5468 KB |
ok |
4 |
Correct |
1 ms |
5468 KB |
ok |
5 |
Correct |
1 ms |
5620 KB |
ok |
6 |
Correct |
2 ms |
5468 KB |
ok |
7 |
Correct |
1 ms |
5468 KB |
ok |
8 |
Correct |
1 ms |
5572 KB |
ok |
9 |
Correct |
1 ms |
5468 KB |
ok |
10 |
Correct |
1 ms |
5468 KB |
ok |
11 |
Correct |
1 ms |
5720 KB |
ok |
12 |
Correct |
1 ms |
5464 KB |
ok |
13 |
Correct |
1 ms |
5468 KB |
ok |
14 |
Correct |
2 ms |
5468 KB |
ok |
15 |
Correct |
2 ms |
5468 KB |
ok |
16 |
Correct |
1 ms |
5468 KB |
ok |
17 |
Correct |
2 ms |
5464 KB |
ok |
18 |
Correct |
1 ms |
5468 KB |
ok |
19 |
Correct |
1 ms |
5468 KB |
ok |
20 |
Correct |
1 ms |
5468 KB |
ok |
21 |
Correct |
2 ms |
5468 KB |
ok |
22 |
Correct |
1 ms |
5468 KB |
ok |
23 |
Correct |
1 ms |
5468 KB |
ok |
24 |
Correct |
1 ms |
5468 KB |
ok |
25 |
Correct |
1 ms |
5468 KB |
ok |
26 |
Correct |
1 ms |
5468 KB |
ok |
27 |
Correct |
1 ms |
5468 KB |
ok |
28 |
Correct |
1 ms |
5464 KB |
ok |
29 |
Correct |
1 ms |
5464 KB |
ok |
30 |
Correct |
2 ms |
7772 KB |
ok |
31 |
Correct |
2 ms |
7772 KB |
ok |
32 |
Correct |
2 ms |
7580 KB |
ok |
33 |
Correct |
2 ms |
7772 KB |
ok |
34 |
Correct |
2 ms |
7772 KB |
ok |
35 |
Correct |
2 ms |
7772 KB |
ok |
36 |
Correct |
2 ms |
7772 KB |
ok |
37 |
Correct |
2 ms |
7772 KB |
ok |
38 |
Correct |
2 ms |
7772 KB |
ok |
39 |
Correct |
2 ms |
7772 KB |
ok |
40 |
Correct |
3 ms |
7772 KB |
ok |
41 |
Correct |
3 ms |
7772 KB |
ok |
42 |
Runtime error |
26 ms |
23872 KB |
Execution killed with signal 11 |
43 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
5464 KB |
ok |
2 |
Correct |
2 ms |
5464 KB |
ok |
3 |
Correct |
1 ms |
5468 KB |
ok |
4 |
Correct |
1 ms |
5468 KB |
ok |
5 |
Correct |
1 ms |
5620 KB |
ok |
6 |
Correct |
1 ms |
5468 KB |
ok |
7 |
Correct |
1 ms |
5468 KB |
ok |
8 |
Runtime error |
9 ms |
15708 KB |
Execution killed with signal 11 |
9 |
Halted |
0 ms |
0 KB |
- |