#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-1,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-1,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][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,i,i));
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
5468 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
5468 KB |
ok |
2 |
Correct |
1 ms |
5468 KB |
ok |
3 |
Correct |
1 ms |
5464 KB |
ok |
4 |
Correct |
1 ms |
5468 KB |
ok |
5 |
Correct |
1 ms |
5464 KB |
ok |
6 |
Correct |
1 ms |
5464 KB |
ok |
7 |
Runtime error |
10 ms |
15708 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
5468 KB |
ok |
2 |
Correct |
1 ms |
5468 KB |
ok |
3 |
Correct |
1 ms |
5468 KB |
ok |
4 |
Correct |
1 ms |
5468 KB |
ok |
5 |
Correct |
1 ms |
5468 KB |
ok |
6 |
Correct |
1 ms |
5468 KB |
ok |
7 |
Correct |
1 ms |
5464 KB |
ok |
8 |
Correct |
1 ms |
5468 KB |
ok |
9 |
Correct |
1 ms |
5468 KB |
ok |
10 |
Correct |
1 ms |
5468 KB |
ok |
11 |
Correct |
1 ms |
5468 KB |
ok |
12 |
Correct |
1 ms |
5560 KB |
ok |
13 |
Correct |
1 ms |
5468 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
5468 KB |
ok |
2 |
Correct |
1 ms |
5468 KB |
ok |
3 |
Correct |
1 ms |
5468 KB |
ok |
4 |
Correct |
1 ms |
5468 KB |
ok |
5 |
Correct |
1 ms |
5468 KB |
ok |
6 |
Correct |
1 ms |
5468 KB |
ok |
7 |
Correct |
1 ms |
5468 KB |
ok |
8 |
Correct |
1 ms |
5464 KB |
ok |
9 |
Correct |
1 ms |
5468 KB |
ok |
10 |
Correct |
1 ms |
5468 KB |
ok |
11 |
Correct |
1 ms |
5468 KB |
ok |
12 |
Correct |
1 ms |
5468 KB |
ok |
13 |
Correct |
1 ms |
5560 KB |
ok |
14 |
Correct |
1 ms |
5468 KB |
ok |
15 |
Correct |
2 ms |
5468 KB |
ok |
16 |
Correct |
1 ms |
5468 KB |
ok |
17 |
Correct |
1 ms |
5468 KB |
ok |
18 |
Correct |
2 ms |
5468 KB |
ok |
19 |
Correct |
1 ms |
5468 KB |
ok |
20 |
Correct |
2 ms |
5464 KB |
ok |
21 |
Correct |
2 ms |
5468 KB |
ok |
22 |
Correct |
1 ms |
5468 KB |
ok |
23 |
Correct |
1 ms |
5464 KB |
ok |
24 |
Correct |
1 ms |
5464 KB |
ok |
25 |
Correct |
1 ms |
5468 KB |
ok |
26 |
Correct |
1 ms |
5468 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
5468 KB |
ok |
2 |
Correct |
1 ms |
5468 KB |
ok |
3 |
Correct |
1 ms |
5468 KB |
ok |
4 |
Correct |
1 ms |
5464 KB |
ok |
5 |
Correct |
1 ms |
5468 KB |
ok |
6 |
Correct |
1 ms |
5468 KB |
ok |
7 |
Correct |
1 ms |
5468 KB |
ok |
8 |
Correct |
1 ms |
5468 KB |
ok |
9 |
Correct |
1 ms |
5468 KB |
ok |
10 |
Correct |
1 ms |
5464 KB |
ok |
11 |
Correct |
1 ms |
5468 KB |
ok |
12 |
Correct |
1 ms |
5468 KB |
ok |
13 |
Correct |
1 ms |
5468 KB |
ok |
14 |
Correct |
1 ms |
5468 KB |
ok |
15 |
Correct |
1 ms |
5560 KB |
ok |
16 |
Correct |
1 ms |
5468 KB |
ok |
17 |
Correct |
2 ms |
5468 KB |
ok |
18 |
Correct |
1 ms |
5468 KB |
ok |
19 |
Correct |
1 ms |
5468 KB |
ok |
20 |
Correct |
2 ms |
5468 KB |
ok |
21 |
Correct |
1 ms |
5468 KB |
ok |
22 |
Correct |
2 ms |
5464 KB |
ok |
23 |
Correct |
2 ms |
5468 KB |
ok |
24 |
Correct |
1 ms |
5468 KB |
ok |
25 |
Correct |
1 ms |
5464 KB |
ok |
26 |
Correct |
1 ms |
5464 KB |
ok |
27 |
Correct |
1 ms |
5468 KB |
ok |
28 |
Correct |
1 ms |
5468 KB |
ok |
29 |
Correct |
1 ms |
5460 KB |
ok |
30 |
Correct |
3 ms |
7772 KB |
ok |
31 |
Correct |
2 ms |
7768 KB |
ok |
32 |
Correct |
2 ms |
7772 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 |
7620 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 |
5468 KB |
ok |
2 |
Correct |
1 ms |
5468 KB |
ok |
3 |
Correct |
1 ms |
5468 KB |
ok |
4 |
Correct |
1 ms |
5464 KB |
ok |
5 |
Correct |
1 ms |
5468 KB |
ok |
6 |
Correct |
1 ms |
5468 KB |
ok |
7 |
Correct |
1 ms |
5468 KB |
ok |
8 |
Correct |
1 ms |
5468 KB |
ok |
9 |
Correct |
1 ms |
5468 KB |
ok |
10 |
Correct |
1 ms |
5464 KB |
ok |
11 |
Correct |
1 ms |
5468 KB |
ok |
12 |
Correct |
1 ms |
5468 KB |
ok |
13 |
Correct |
1 ms |
5468 KB |
ok |
14 |
Correct |
1 ms |
5468 KB |
ok |
15 |
Correct |
1 ms |
5560 KB |
ok |
16 |
Correct |
1 ms |
5468 KB |
ok |
17 |
Correct |
2 ms |
5468 KB |
ok |
18 |
Correct |
1 ms |
5468 KB |
ok |
19 |
Correct |
1 ms |
5468 KB |
ok |
20 |
Correct |
2 ms |
5468 KB |
ok |
21 |
Correct |
1 ms |
5468 KB |
ok |
22 |
Correct |
2 ms |
5464 KB |
ok |
23 |
Correct |
2 ms |
5468 KB |
ok |
24 |
Correct |
1 ms |
5468 KB |
ok |
25 |
Correct |
1 ms |
5464 KB |
ok |
26 |
Correct |
1 ms |
5464 KB |
ok |
27 |
Correct |
1 ms |
5468 KB |
ok |
28 |
Correct |
1 ms |
5468 KB |
ok |
29 |
Correct |
1 ms |
5460 KB |
ok |
30 |
Correct |
3 ms |
7772 KB |
ok |
31 |
Correct |
2 ms |
7768 KB |
ok |
32 |
Correct |
2 ms |
7772 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 |
7620 KB |
ok |
40 |
Correct |
3 ms |
7772 KB |
ok |
41 |
Correct |
3 ms |
7772 KB |
ok |
42 |
Runtime error |
29 ms |
24244 KB |
Execution killed with signal 11 |
43 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
5468 KB |
ok |
2 |
Correct |
1 ms |
5468 KB |
ok |
3 |
Correct |
1 ms |
5468 KB |
ok |
4 |
Correct |
1 ms |
5464 KB |
ok |
5 |
Correct |
1 ms |
5468 KB |
ok |
6 |
Correct |
1 ms |
5464 KB |
ok |
7 |
Correct |
1 ms |
5464 KB |
ok |
8 |
Runtime error |
10 ms |
15708 KB |
Execution killed with signal 11 |
9 |
Halted |
0 ms |
0 KB |
- |