#include "soccer.h"
#include <bits/stdc++.h>
using namespace std;
const int mxn=502;
int n,ans,dp[mxn][mxn][mxn],s[2001][2001],l[mxn][mxn][mxn],r[mxn][mxn][mxn];
int sum(int l, int r, int i){
return s[r][i]-s[l][i];
}
int f(int i, int j, int k){
if (i==j)
return 0;
if (dp[i][j][k]!=-1)
return dp[i][j][k];
return dp[i][j][k]=max(f(i+1,j,l[i+1][j][k])+(l[i][j][k]-l[i+1][j][k]+r[i+1][j][k]-r[i][j][k])*(j-i-1),f(i,j-1,l[i][j-1][k])+(l[i][j][k]-l[i][j-1][k]+r[i][j-1][k]-r[i][j][k])*(j-i-1));
}
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];
for (int k=0;k<=n;k++)
for (int i=0;i<n;i++){
int x=k,y=k;
for (int j=n;j>i;j--){
while (x&&!sum(i,j,x-1))
x--;
l[i][j][k]=x;
while (y<n&&!sum(i,j,y))
y++;
r[i][j][k]=y;
}
}
for (int i=0;i<n;i++)
for (int j=n;j>i;j--)
for (int k=0;k<=n;k++)
dp[i][j][k]=-1;
for (int i=0;i<=n;i++)
ans=max(ans,f(0,n,l[0][n][i])+(r[0][n][i]-l[0][n][i])*n);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
16732 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
10588 KB |
ok |
2 |
Correct |
2 ms |
10588 KB |
ok |
3 |
Correct |
3 ms |
26968 KB |
ok |
4 |
Correct |
4 ms |
31160 KB |
ok |
5 |
Correct |
1 ms |
4440 KB |
ok |
6 |
Correct |
1 ms |
10588 KB |
ok |
7 |
Correct |
82 ms |
296532 KB |
ok |
8 |
Correct |
1105 ms |
1333588 KB |
ok |
9 |
Runtime error |
995 ms |
2063332 KB |
Execution killed with signal 11 |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
10588 KB |
ok |
2 |
Correct |
2 ms |
10588 KB |
ok |
3 |
Correct |
1 ms |
10584 KB |
ok |
4 |
Correct |
1 ms |
10584 KB |
ok |
5 |
Correct |
2 ms |
10588 KB |
ok |
6 |
Correct |
2 ms |
10840 KB |
ok |
7 |
Correct |
2 ms |
10588 KB |
ok |
8 |
Correct |
2 ms |
10724 KB |
ok |
9 |
Correct |
2 ms |
10588 KB |
ok |
10 |
Correct |
1 ms |
10684 KB |
ok |
11 |
Correct |
1 ms |
10584 KB |
ok |
12 |
Correct |
1 ms |
10584 KB |
ok |
13 |
Correct |
1 ms |
10588 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
16732 KB |
ok |
2 |
Correct |
1 ms |
10588 KB |
ok |
3 |
Correct |
2 ms |
10588 KB |
ok |
4 |
Correct |
1 ms |
10584 KB |
ok |
5 |
Correct |
1 ms |
10584 KB |
ok |
6 |
Correct |
2 ms |
10588 KB |
ok |
7 |
Correct |
2 ms |
10840 KB |
ok |
8 |
Correct |
2 ms |
10588 KB |
ok |
9 |
Correct |
2 ms |
10724 KB |
ok |
10 |
Correct |
2 ms |
10588 KB |
ok |
11 |
Correct |
1 ms |
10684 KB |
ok |
12 |
Correct |
1 ms |
10584 KB |
ok |
13 |
Correct |
1 ms |
10584 KB |
ok |
14 |
Correct |
1 ms |
10588 KB |
ok |
15 |
Correct |
3 ms |
22872 KB |
ok |
16 |
Correct |
3 ms |
22872 KB |
ok |
17 |
Correct |
3 ms |
22876 KB |
ok |
18 |
Correct |
3 ms |
22976 KB |
ok |
19 |
Correct |
3 ms |
22872 KB |
ok |
20 |
Correct |
3 ms |
22872 KB |
ok |
21 |
Correct |
3 ms |
22876 KB |
ok |
22 |
Correct |
3 ms |
22872 KB |
ok |
23 |
Correct |
3 ms |
22876 KB |
ok |
24 |
Correct |
3 ms |
22876 KB |
ok |
25 |
Correct |
3 ms |
22876 KB |
ok |
26 |
Correct |
3 ms |
22876 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
16732 KB |
ok |
2 |
Correct |
1 ms |
10588 KB |
ok |
3 |
Correct |
2 ms |
10588 KB |
ok |
4 |
Correct |
3 ms |
26968 KB |
ok |
5 |
Correct |
4 ms |
31160 KB |
ok |
6 |
Correct |
1 ms |
10584 KB |
ok |
7 |
Correct |
1 ms |
10584 KB |
ok |
8 |
Correct |
2 ms |
10588 KB |
ok |
9 |
Correct |
2 ms |
10840 KB |
ok |
10 |
Correct |
2 ms |
10588 KB |
ok |
11 |
Correct |
2 ms |
10724 KB |
ok |
12 |
Correct |
2 ms |
10588 KB |
ok |
13 |
Correct |
1 ms |
10684 KB |
ok |
14 |
Correct |
1 ms |
10584 KB |
ok |
15 |
Correct |
1 ms |
10584 KB |
ok |
16 |
Correct |
1 ms |
10588 KB |
ok |
17 |
Correct |
3 ms |
22872 KB |
ok |
18 |
Correct |
3 ms |
22872 KB |
ok |
19 |
Correct |
3 ms |
22876 KB |
ok |
20 |
Correct |
3 ms |
22976 KB |
ok |
21 |
Correct |
3 ms |
22872 KB |
ok |
22 |
Correct |
3 ms |
22872 KB |
ok |
23 |
Correct |
3 ms |
22876 KB |
ok |
24 |
Correct |
3 ms |
22872 KB |
ok |
25 |
Correct |
3 ms |
22876 KB |
ok |
26 |
Correct |
3 ms |
22876 KB |
ok |
27 |
Correct |
3 ms |
22876 KB |
ok |
28 |
Correct |
3 ms |
22876 KB |
ok |
29 |
Correct |
3 ms |
22872 KB |
ok |
30 |
Correct |
12 ms |
90712 KB |
ok |
31 |
Correct |
10 ms |
90716 KB |
ok |
32 |
Correct |
10 ms |
90840 KB |
ok |
33 |
Correct |
10 ms |
90716 KB |
ok |
34 |
Correct |
10 ms |
90716 KB |
ok |
35 |
Correct |
10 ms |
90772 KB |
ok |
36 |
Correct |
11 ms |
90716 KB |
ok |
37 |
Correct |
10 ms |
90760 KB |
ok |
38 |
Correct |
10 ms |
90716 KB |
ok |
39 |
Correct |
10 ms |
90760 KB |
ok |
40 |
Correct |
10 ms |
90716 KB |
ok |
41 |
Correct |
10 ms |
90716 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
16732 KB |
ok |
2 |
Correct |
1 ms |
10588 KB |
ok |
3 |
Correct |
2 ms |
10588 KB |
ok |
4 |
Correct |
3 ms |
26968 KB |
ok |
5 |
Correct |
4 ms |
31160 KB |
ok |
6 |
Correct |
1 ms |
10584 KB |
ok |
7 |
Correct |
1 ms |
10584 KB |
ok |
8 |
Correct |
2 ms |
10588 KB |
ok |
9 |
Correct |
2 ms |
10840 KB |
ok |
10 |
Correct |
2 ms |
10588 KB |
ok |
11 |
Correct |
2 ms |
10724 KB |
ok |
12 |
Correct |
2 ms |
10588 KB |
ok |
13 |
Correct |
1 ms |
10684 KB |
ok |
14 |
Correct |
1 ms |
10584 KB |
ok |
15 |
Correct |
1 ms |
10584 KB |
ok |
16 |
Correct |
1 ms |
10588 KB |
ok |
17 |
Correct |
3 ms |
22872 KB |
ok |
18 |
Correct |
3 ms |
22872 KB |
ok |
19 |
Correct |
3 ms |
22876 KB |
ok |
20 |
Correct |
3 ms |
22976 KB |
ok |
21 |
Correct |
3 ms |
22872 KB |
ok |
22 |
Correct |
3 ms |
22872 KB |
ok |
23 |
Correct |
3 ms |
22876 KB |
ok |
24 |
Correct |
3 ms |
22872 KB |
ok |
25 |
Correct |
3 ms |
22876 KB |
ok |
26 |
Correct |
3 ms |
22876 KB |
ok |
27 |
Correct |
3 ms |
22876 KB |
ok |
28 |
Correct |
3 ms |
22876 KB |
ok |
29 |
Correct |
3 ms |
22872 KB |
ok |
30 |
Correct |
12 ms |
90712 KB |
ok |
31 |
Correct |
10 ms |
90716 KB |
ok |
32 |
Correct |
10 ms |
90840 KB |
ok |
33 |
Correct |
10 ms |
90716 KB |
ok |
34 |
Correct |
10 ms |
90716 KB |
ok |
35 |
Correct |
10 ms |
90772 KB |
ok |
36 |
Correct |
11 ms |
90716 KB |
ok |
37 |
Correct |
10 ms |
90760 KB |
ok |
38 |
Correct |
10 ms |
90716 KB |
ok |
39 |
Correct |
10 ms |
90760 KB |
ok |
40 |
Correct |
10 ms |
90716 KB |
ok |
41 |
Correct |
10 ms |
90716 KB |
ok |
42 |
Execution timed out |
4553 ms |
1334696 KB |
Time limit exceeded |
43 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
16732 KB |
ok |
2 |
Correct |
1 ms |
10588 KB |
ok |
3 |
Correct |
2 ms |
10588 KB |
ok |
4 |
Correct |
3 ms |
26968 KB |
ok |
5 |
Correct |
4 ms |
31160 KB |
ok |
6 |
Correct |
1 ms |
4440 KB |
ok |
7 |
Correct |
1 ms |
10588 KB |
ok |
8 |
Correct |
82 ms |
296532 KB |
ok |
9 |
Correct |
1105 ms |
1333588 KB |
ok |
10 |
Runtime error |
995 ms |
2063332 KB |
Execution killed with signal 11 |
11 |
Halted |
0 ms |
0 KB |
- |