#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,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,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,i)+(r[0][n][i]-l[0][n][i])*n);
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
16732 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
10588 KB |
ok |
2 |
Correct |
2 ms |
10588 KB |
ok |
3 |
Correct |
3 ms |
26968 KB |
ok |
4 |
Correct |
5 ms |
31068 KB |
ok |
5 |
Correct |
1 ms |
4444 KB |
ok |
6 |
Correct |
1 ms |
10588 KB |
ok |
7 |
Correct |
90 ms |
296532 KB |
ok |
8 |
Execution timed out |
4571 ms |
825080 KB |
Time limit exceeded |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
10588 KB |
ok |
2 |
Correct |
2 ms |
10588 KB |
ok |
3 |
Correct |
1 ms |
10588 KB |
ok |
4 |
Correct |
1 ms |
10588 KB |
ok |
5 |
Correct |
1 ms |
10588 KB |
ok |
6 |
Correct |
1 ms |
10588 KB |
ok |
7 |
Correct |
1 ms |
10720 KB |
ok |
8 |
Correct |
1 ms |
10588 KB |
ok |
9 |
Correct |
1 ms |
10588 KB |
ok |
10 |
Correct |
2 ms |
10588 KB |
ok |
11 |
Correct |
1 ms |
10588 KB |
ok |
12 |
Correct |
1 ms |
10588 KB |
ok |
13 |
Correct |
1 ms |
10588 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
16732 KB |
ok |
2 |
Correct |
2 ms |
10588 KB |
ok |
3 |
Correct |
2 ms |
10588 KB |
ok |
4 |
Correct |
1 ms |
10588 KB |
ok |
5 |
Correct |
1 ms |
10588 KB |
ok |
6 |
Correct |
1 ms |
10588 KB |
ok |
7 |
Correct |
1 ms |
10588 KB |
ok |
8 |
Correct |
1 ms |
10720 KB |
ok |
9 |
Correct |
1 ms |
10588 KB |
ok |
10 |
Correct |
1 ms |
10588 KB |
ok |
11 |
Correct |
2 ms |
10588 KB |
ok |
12 |
Correct |
1 ms |
10588 KB |
ok |
13 |
Correct |
1 ms |
10588 KB |
ok |
14 |
Correct |
1 ms |
10588 KB |
ok |
15 |
Correct |
3 ms |
22872 KB |
ok |
16 |
Correct |
3 ms |
22876 KB |
ok |
17 |
Correct |
3 ms |
22876 KB |
ok |
18 |
Correct |
3 ms |
22876 KB |
ok |
19 |
Correct |
3 ms |
22876 KB |
ok |
20 |
Correct |
3 ms |
22872 KB |
ok |
21 |
Correct |
3 ms |
22876 KB |
ok |
22 |
Correct |
3 ms |
22876 KB |
ok |
23 |
Correct |
3 ms |
23052 KB |
ok |
24 |
Correct |
3 ms |
23012 KB |
ok |
25 |
Correct |
3 ms |
22876 KB |
ok |
26 |
Correct |
3 ms |
22876 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
16732 KB |
ok |
2 |
Correct |
2 ms |
10588 KB |
ok |
3 |
Correct |
2 ms |
10588 KB |
ok |
4 |
Correct |
3 ms |
26968 KB |
ok |
5 |
Correct |
5 ms |
31068 KB |
ok |
6 |
Correct |
1 ms |
10588 KB |
ok |
7 |
Correct |
1 ms |
10588 KB |
ok |
8 |
Correct |
1 ms |
10588 KB |
ok |
9 |
Correct |
1 ms |
10588 KB |
ok |
10 |
Correct |
1 ms |
10720 KB |
ok |
11 |
Correct |
1 ms |
10588 KB |
ok |
12 |
Correct |
1 ms |
10588 KB |
ok |
13 |
Correct |
2 ms |
10588 KB |
ok |
14 |
Correct |
1 ms |
10588 KB |
ok |
15 |
Correct |
1 ms |
10588 KB |
ok |
16 |
Correct |
1 ms |
10588 KB |
ok |
17 |
Correct |
3 ms |
22872 KB |
ok |
18 |
Correct |
3 ms |
22876 KB |
ok |
19 |
Correct |
3 ms |
22876 KB |
ok |
20 |
Correct |
3 ms |
22876 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 |
23052 KB |
ok |
26 |
Correct |
3 ms |
23012 KB |
ok |
27 |
Correct |
3 ms |
22876 KB |
ok |
28 |
Correct |
3 ms |
22876 KB |
ok |
29 |
Correct |
3 ms |
22876 KB |
ok |
30 |
Correct |
11 ms |
90716 KB |
ok |
31 |
Correct |
10 ms |
90968 KB |
ok |
32 |
Correct |
10 ms |
90856 KB |
ok |
33 |
Correct |
10 ms |
90712 KB |
ok |
34 |
Correct |
10 ms |
90712 KB |
ok |
35 |
Correct |
10 ms |
90868 KB |
ok |
36 |
Correct |
11 ms |
90716 KB |
ok |
37 |
Correct |
10 ms |
90712 KB |
ok |
38 |
Correct |
10 ms |
91048 KB |
ok |
39 |
Correct |
10 ms |
90716 KB |
ok |
40 |
Correct |
10 ms |
90764 KB |
ok |
41 |
Correct |
10 ms |
90712 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
16732 KB |
ok |
2 |
Correct |
2 ms |
10588 KB |
ok |
3 |
Correct |
2 ms |
10588 KB |
ok |
4 |
Correct |
3 ms |
26968 KB |
ok |
5 |
Correct |
5 ms |
31068 KB |
ok |
6 |
Correct |
1 ms |
10588 KB |
ok |
7 |
Correct |
1 ms |
10588 KB |
ok |
8 |
Correct |
1 ms |
10588 KB |
ok |
9 |
Correct |
1 ms |
10588 KB |
ok |
10 |
Correct |
1 ms |
10720 KB |
ok |
11 |
Correct |
1 ms |
10588 KB |
ok |
12 |
Correct |
1 ms |
10588 KB |
ok |
13 |
Correct |
2 ms |
10588 KB |
ok |
14 |
Correct |
1 ms |
10588 KB |
ok |
15 |
Correct |
1 ms |
10588 KB |
ok |
16 |
Correct |
1 ms |
10588 KB |
ok |
17 |
Correct |
3 ms |
22872 KB |
ok |
18 |
Correct |
3 ms |
22876 KB |
ok |
19 |
Correct |
3 ms |
22876 KB |
ok |
20 |
Correct |
3 ms |
22876 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 |
23052 KB |
ok |
26 |
Correct |
3 ms |
23012 KB |
ok |
27 |
Correct |
3 ms |
22876 KB |
ok |
28 |
Correct |
3 ms |
22876 KB |
ok |
29 |
Correct |
3 ms |
22876 KB |
ok |
30 |
Correct |
11 ms |
90716 KB |
ok |
31 |
Correct |
10 ms |
90968 KB |
ok |
32 |
Correct |
10 ms |
90856 KB |
ok |
33 |
Correct |
10 ms |
90712 KB |
ok |
34 |
Correct |
10 ms |
90712 KB |
ok |
35 |
Correct |
10 ms |
90868 KB |
ok |
36 |
Correct |
11 ms |
90716 KB |
ok |
37 |
Correct |
10 ms |
90712 KB |
ok |
38 |
Correct |
10 ms |
91048 KB |
ok |
39 |
Correct |
10 ms |
90716 KB |
ok |
40 |
Correct |
10 ms |
90764 KB |
ok |
41 |
Correct |
10 ms |
90712 KB |
ok |
42 |
Execution timed out |
4570 ms |
827424 KB |
Time limit exceeded |
43 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
16732 KB |
ok |
2 |
Correct |
2 ms |
10588 KB |
ok |
3 |
Correct |
2 ms |
10588 KB |
ok |
4 |
Correct |
3 ms |
26968 KB |
ok |
5 |
Correct |
5 ms |
31068 KB |
ok |
6 |
Correct |
1 ms |
4444 KB |
ok |
7 |
Correct |
1 ms |
10588 KB |
ok |
8 |
Correct |
90 ms |
296532 KB |
ok |
9 |
Execution timed out |
4571 ms |
825080 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |