#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 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 L=1;L<=n;L++)
for (int i=0;i<n;i++)
for (int k=0;k<=n;k++){
int j=i+L;
dp[i][j][k]=max(dp[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),dp[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));
}
for (int i=0;i<=n;i++)
ans=max(ans,dp[0][n][i]+(r[0][n][i]-l[0][n][i])*n);
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
10588 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6488 KB |
ok |
2 |
Correct |
1 ms |
6492 KB |
ok |
3 |
Correct |
3 ms |
19288 KB |
ok |
4 |
Correct |
3 ms |
21080 KB |
ok |
5 |
Correct |
1 ms |
2396 KB |
ok |
6 |
Correct |
1 ms |
6492 KB |
ok |
7 |
Correct |
71 ms |
218524 KB |
ok |
8 |
Correct |
1872 ms |
1071852 KB |
ok |
9 |
Runtime error |
1228 ms |
2059232 KB |
Execution killed with signal 11 |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6488 KB |
ok |
2 |
Correct |
1 ms |
6492 KB |
ok |
3 |
Correct |
1 ms |
6488 KB |
ok |
4 |
Correct |
1 ms |
6488 KB |
ok |
5 |
Correct |
1 ms |
6744 KB |
ok |
6 |
Correct |
1 ms |
6492 KB |
ok |
7 |
Correct |
1 ms |
6488 KB |
ok |
8 |
Correct |
1 ms |
6492 KB |
ok |
9 |
Correct |
1 ms |
6744 KB |
ok |
10 |
Correct |
1 ms |
6492 KB |
ok |
11 |
Correct |
1 ms |
6620 KB |
ok |
12 |
Correct |
1 ms |
6492 KB |
ok |
13 |
Correct |
1 ms |
6492 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
10588 KB |
ok |
2 |
Correct |
1 ms |
6488 KB |
ok |
3 |
Correct |
1 ms |
6492 KB |
ok |
4 |
Correct |
1 ms |
6488 KB |
ok |
5 |
Correct |
1 ms |
6488 KB |
ok |
6 |
Correct |
1 ms |
6744 KB |
ok |
7 |
Correct |
1 ms |
6492 KB |
ok |
8 |
Correct |
1 ms |
6488 KB |
ok |
9 |
Correct |
1 ms |
6492 KB |
ok |
10 |
Correct |
1 ms |
6744 KB |
ok |
11 |
Correct |
1 ms |
6492 KB |
ok |
12 |
Correct |
1 ms |
6620 KB |
ok |
13 |
Correct |
1 ms |
6492 KB |
ok |
14 |
Correct |
1 ms |
6492 KB |
ok |
15 |
Correct |
2 ms |
14940 KB |
ok |
16 |
Correct |
2 ms |
14936 KB |
ok |
17 |
Correct |
2 ms |
14940 KB |
ok |
18 |
Correct |
2 ms |
15192 KB |
ok |
19 |
Correct |
2 ms |
14940 KB |
ok |
20 |
Correct |
2 ms |
14940 KB |
ok |
21 |
Correct |
2 ms |
14768 KB |
ok |
22 |
Correct |
2 ms |
14940 KB |
ok |
23 |
Correct |
2 ms |
14940 KB |
ok |
24 |
Correct |
2 ms |
14940 KB |
ok |
25 |
Correct |
2 ms |
14940 KB |
ok |
26 |
Correct |
2 ms |
14940 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
10588 KB |
ok |
2 |
Correct |
1 ms |
6488 KB |
ok |
3 |
Correct |
1 ms |
6492 KB |
ok |
4 |
Correct |
3 ms |
19288 KB |
ok |
5 |
Correct |
3 ms |
21080 KB |
ok |
6 |
Correct |
1 ms |
6488 KB |
ok |
7 |
Correct |
1 ms |
6488 KB |
ok |
8 |
Correct |
1 ms |
6744 KB |
ok |
9 |
Correct |
1 ms |
6492 KB |
ok |
10 |
Correct |
1 ms |
6488 KB |
ok |
11 |
Correct |
1 ms |
6492 KB |
ok |
12 |
Correct |
1 ms |
6744 KB |
ok |
13 |
Correct |
1 ms |
6492 KB |
ok |
14 |
Correct |
1 ms |
6620 KB |
ok |
15 |
Correct |
1 ms |
6492 KB |
ok |
16 |
Correct |
1 ms |
6492 KB |
ok |
17 |
Correct |
2 ms |
14940 KB |
ok |
18 |
Correct |
2 ms |
14936 KB |
ok |
19 |
Correct |
2 ms |
14940 KB |
ok |
20 |
Correct |
2 ms |
15192 KB |
ok |
21 |
Correct |
2 ms |
14940 KB |
ok |
22 |
Correct |
2 ms |
14940 KB |
ok |
23 |
Correct |
2 ms |
14768 KB |
ok |
24 |
Correct |
2 ms |
14940 KB |
ok |
25 |
Correct |
2 ms |
14940 KB |
ok |
26 |
Correct |
2 ms |
14940 KB |
ok |
27 |
Correct |
2 ms |
14940 KB |
ok |
28 |
Correct |
2 ms |
14940 KB |
ok |
29 |
Correct |
2 ms |
14940 KB |
ok |
30 |
Correct |
8 ms |
61788 KB |
ok |
31 |
Correct |
8 ms |
61788 KB |
ok |
32 |
Correct |
8 ms |
62044 KB |
ok |
33 |
Correct |
8 ms |
61812 KB |
ok |
34 |
Correct |
8 ms |
62040 KB |
ok |
35 |
Correct |
8 ms |
61788 KB |
ok |
36 |
Correct |
8 ms |
61852 KB |
ok |
37 |
Correct |
8 ms |
62044 KB |
ok |
38 |
Correct |
8 ms |
62044 KB |
ok |
39 |
Correct |
8 ms |
62044 KB |
ok |
40 |
Correct |
8 ms |
62040 KB |
ok |
41 |
Correct |
8 ms |
62044 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
10588 KB |
ok |
2 |
Correct |
1 ms |
6488 KB |
ok |
3 |
Correct |
1 ms |
6492 KB |
ok |
4 |
Correct |
3 ms |
19288 KB |
ok |
5 |
Correct |
3 ms |
21080 KB |
ok |
6 |
Correct |
1 ms |
6488 KB |
ok |
7 |
Correct |
1 ms |
6488 KB |
ok |
8 |
Correct |
1 ms |
6744 KB |
ok |
9 |
Correct |
1 ms |
6492 KB |
ok |
10 |
Correct |
1 ms |
6488 KB |
ok |
11 |
Correct |
1 ms |
6492 KB |
ok |
12 |
Correct |
1 ms |
6744 KB |
ok |
13 |
Correct |
1 ms |
6492 KB |
ok |
14 |
Correct |
1 ms |
6620 KB |
ok |
15 |
Correct |
1 ms |
6492 KB |
ok |
16 |
Correct |
1 ms |
6492 KB |
ok |
17 |
Correct |
2 ms |
14940 KB |
ok |
18 |
Correct |
2 ms |
14936 KB |
ok |
19 |
Correct |
2 ms |
14940 KB |
ok |
20 |
Correct |
2 ms |
15192 KB |
ok |
21 |
Correct |
2 ms |
14940 KB |
ok |
22 |
Correct |
2 ms |
14940 KB |
ok |
23 |
Correct |
2 ms |
14768 KB |
ok |
24 |
Correct |
2 ms |
14940 KB |
ok |
25 |
Correct |
2 ms |
14940 KB |
ok |
26 |
Correct |
2 ms |
14940 KB |
ok |
27 |
Correct |
2 ms |
14940 KB |
ok |
28 |
Correct |
2 ms |
14940 KB |
ok |
29 |
Correct |
2 ms |
14940 KB |
ok |
30 |
Correct |
8 ms |
61788 KB |
ok |
31 |
Correct |
8 ms |
61788 KB |
ok |
32 |
Correct |
8 ms |
62044 KB |
ok |
33 |
Correct |
8 ms |
61812 KB |
ok |
34 |
Correct |
8 ms |
62040 KB |
ok |
35 |
Correct |
8 ms |
61788 KB |
ok |
36 |
Correct |
8 ms |
61852 KB |
ok |
37 |
Correct |
8 ms |
62044 KB |
ok |
38 |
Correct |
8 ms |
62044 KB |
ok |
39 |
Correct |
8 ms |
62044 KB |
ok |
40 |
Correct |
8 ms |
62040 KB |
ok |
41 |
Correct |
8 ms |
62044 KB |
ok |
42 |
Correct |
1367 ms |
1098420 KB |
ok |
43 |
Correct |
1433 ms |
1098848 KB |
ok |
44 |
Correct |
1553 ms |
1098808 KB |
ok |
45 |
Correct |
1649 ms |
1100136 KB |
ok |
46 |
Correct |
1426 ms |
1098848 KB |
ok |
47 |
Correct |
1731 ms |
1099048 KB |
ok |
48 |
Correct |
1582 ms |
1100848 KB |
ok |
49 |
Correct |
1588 ms |
1100864 KB |
ok |
50 |
Correct |
1598 ms |
1101776 KB |
ok |
51 |
Correct |
1417 ms |
1101648 KB |
ok |
52 |
Correct |
1460 ms |
1100748 KB |
ok |
53 |
Correct |
1472 ms |
1099916 KB |
ok |
54 |
Correct |
1456 ms |
1098920 KB |
ok |
55 |
Correct |
1488 ms |
1099900 KB |
ok |
56 |
Correct |
1508 ms |
1099836 KB |
ok |
57 |
Correct |
1680 ms |
1099944 KB |
ok |
58 |
Correct |
1400 ms |
1421220 KB |
ok |
59 |
Correct |
1285 ms |
1490092 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
10588 KB |
ok |
2 |
Correct |
1 ms |
6488 KB |
ok |
3 |
Correct |
1 ms |
6492 KB |
ok |
4 |
Correct |
3 ms |
19288 KB |
ok |
5 |
Correct |
3 ms |
21080 KB |
ok |
6 |
Correct |
1 ms |
2396 KB |
ok |
7 |
Correct |
1 ms |
6492 KB |
ok |
8 |
Correct |
71 ms |
218524 KB |
ok |
9 |
Correct |
1872 ms |
1071852 KB |
ok |
10 |
Runtime error |
1228 ms |
2059232 KB |
Execution killed with signal 11 |
11 |
Halted |
0 ms |
0 KB |
- |