#include "soccer.h"
#include <bits/stdc++.h>
using namespace std;
const int mxn=2006;
int n,ans,s[mxn][mxn];
vector <int> dp[mxn][mxn],l[mxn][mxn],r[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;
int S=0;
for (int i=0;i<n;i++)
for (int j=0;j<n;j++){
s[i+1][j]=s[i][j]+F[i][j];
if (!F[i][j])
S=j;
}
for (int k=(n<=500?0:S);k<=(n<=500?n:S);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].push_back(x);
while (y<n&&!sum(i,j,y))
y++;
r[i][j].push_back(y);
dp[i][j].push_back(0);
}
}
for (int L=0;L<n;L++)
for (int i=0;i+L+1<=n;i++)
for (int k=0;k<=(n<=500?n:0);k++){
int j=i+L+1;
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])*L,dp[i][j-1][k]+(l[i][j][k]-l[i][j-1][k]+r[i][j-1][k]-r[i][j][k])*L);
}
for (int i=0;i<=(n<=500?n:0);i++)
ans=max(ans,dp[0][n][i]+(r[0][n][i]-l[0][n][i])*n);
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
100 ms |
285776 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
62 ms |
285780 KB |
ok |
2 |
Correct |
60 ms |
285812 KB |
ok |
3 |
Correct |
61 ms |
285776 KB |
ok |
4 |
Correct |
62 ms |
285780 KB |
ok |
5 |
Correct |
62 ms |
285780 KB |
ok |
6 |
Correct |
61 ms |
285780 KB |
ok |
7 |
Correct |
79 ms |
293884 KB |
ok |
8 |
Correct |
3851 ms |
1053820 KB |
ok |
9 |
Correct |
637 ms |
525140 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
62 ms |
285780 KB |
ok |
2 |
Correct |
60 ms |
285812 KB |
ok |
3 |
Correct |
61 ms |
285788 KB |
ok |
4 |
Correct |
64 ms |
285780 KB |
ok |
5 |
Correct |
63 ms |
285780 KB |
ok |
6 |
Correct |
67 ms |
285776 KB |
ok |
7 |
Correct |
62 ms |
286016 KB |
ok |
8 |
Correct |
63 ms |
285592 KB |
ok |
9 |
Correct |
63 ms |
285780 KB |
ok |
10 |
Correct |
62 ms |
285776 KB |
ok |
11 |
Correct |
62 ms |
285776 KB |
ok |
12 |
Correct |
63 ms |
285664 KB |
ok |
13 |
Correct |
66 ms |
285776 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
100 ms |
285776 KB |
ok |
2 |
Correct |
62 ms |
285780 KB |
ok |
3 |
Correct |
60 ms |
285812 KB |
ok |
4 |
Correct |
61 ms |
285788 KB |
ok |
5 |
Correct |
64 ms |
285780 KB |
ok |
6 |
Correct |
63 ms |
285780 KB |
ok |
7 |
Correct |
67 ms |
285776 KB |
ok |
8 |
Correct |
62 ms |
286016 KB |
ok |
9 |
Correct |
63 ms |
285592 KB |
ok |
10 |
Correct |
63 ms |
285780 KB |
ok |
11 |
Correct |
62 ms |
285776 KB |
ok |
12 |
Correct |
62 ms |
285776 KB |
ok |
13 |
Correct |
63 ms |
285664 KB |
ok |
14 |
Correct |
66 ms |
285776 KB |
ok |
15 |
Correct |
62 ms |
285684 KB |
ok |
16 |
Correct |
64 ms |
285780 KB |
ok |
17 |
Correct |
63 ms |
285776 KB |
ok |
18 |
Correct |
63 ms |
285772 KB |
ok |
19 |
Correct |
61 ms |
285780 KB |
ok |
20 |
Correct |
62 ms |
285776 KB |
ok |
21 |
Correct |
61 ms |
285776 KB |
ok |
22 |
Correct |
62 ms |
286036 KB |
ok |
23 |
Correct |
63 ms |
285776 KB |
ok |
24 |
Correct |
63 ms |
285800 KB |
ok |
25 |
Correct |
63 ms |
285780 KB |
ok |
26 |
Correct |
62 ms |
285776 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
100 ms |
285776 KB |
ok |
2 |
Correct |
62 ms |
285780 KB |
ok |
3 |
Correct |
60 ms |
285812 KB |
ok |
4 |
Correct |
61 ms |
285776 KB |
ok |
5 |
Correct |
62 ms |
285780 KB |
ok |
6 |
Correct |
61 ms |
285788 KB |
ok |
7 |
Correct |
64 ms |
285780 KB |
ok |
8 |
Correct |
63 ms |
285780 KB |
ok |
9 |
Correct |
67 ms |
285776 KB |
ok |
10 |
Correct |
62 ms |
286016 KB |
ok |
11 |
Correct |
63 ms |
285592 KB |
ok |
12 |
Correct |
63 ms |
285780 KB |
ok |
13 |
Correct |
62 ms |
285776 KB |
ok |
14 |
Correct |
62 ms |
285776 KB |
ok |
15 |
Correct |
63 ms |
285664 KB |
ok |
16 |
Correct |
66 ms |
285776 KB |
ok |
17 |
Correct |
62 ms |
285684 KB |
ok |
18 |
Correct |
64 ms |
285780 KB |
ok |
19 |
Correct |
63 ms |
285776 KB |
ok |
20 |
Correct |
63 ms |
285772 KB |
ok |
21 |
Correct |
61 ms |
285780 KB |
ok |
22 |
Correct |
62 ms |
285776 KB |
ok |
23 |
Correct |
61 ms |
285776 KB |
ok |
24 |
Correct |
62 ms |
286036 KB |
ok |
25 |
Correct |
63 ms |
285776 KB |
ok |
26 |
Correct |
63 ms |
285800 KB |
ok |
27 |
Correct |
63 ms |
285780 KB |
ok |
28 |
Correct |
62 ms |
285776 KB |
ok |
29 |
Correct |
61 ms |
285776 KB |
ok |
30 |
Correct |
63 ms |
285932 KB |
ok |
31 |
Correct |
62 ms |
286036 KB |
ok |
32 |
Correct |
64 ms |
286036 KB |
ok |
33 |
Correct |
64 ms |
286032 KB |
ok |
34 |
Correct |
66 ms |
286036 KB |
ok |
35 |
Correct |
62 ms |
286032 KB |
ok |
36 |
Correct |
64 ms |
285828 KB |
ok |
37 |
Correct |
63 ms |
286040 KB |
ok |
38 |
Correct |
62 ms |
286032 KB |
ok |
39 |
Correct |
62 ms |
286040 KB |
ok |
40 |
Correct |
63 ms |
286240 KB |
ok |
41 |
Correct |
63 ms |
286032 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
100 ms |
285776 KB |
ok |
2 |
Correct |
62 ms |
285780 KB |
ok |
3 |
Correct |
60 ms |
285812 KB |
ok |
4 |
Correct |
61 ms |
285776 KB |
ok |
5 |
Correct |
62 ms |
285780 KB |
ok |
6 |
Correct |
61 ms |
285788 KB |
ok |
7 |
Correct |
64 ms |
285780 KB |
ok |
8 |
Correct |
63 ms |
285780 KB |
ok |
9 |
Correct |
67 ms |
285776 KB |
ok |
10 |
Correct |
62 ms |
286016 KB |
ok |
11 |
Correct |
63 ms |
285592 KB |
ok |
12 |
Correct |
63 ms |
285780 KB |
ok |
13 |
Correct |
62 ms |
285776 KB |
ok |
14 |
Correct |
62 ms |
285776 KB |
ok |
15 |
Correct |
63 ms |
285664 KB |
ok |
16 |
Correct |
66 ms |
285776 KB |
ok |
17 |
Correct |
62 ms |
285684 KB |
ok |
18 |
Correct |
64 ms |
285780 KB |
ok |
19 |
Correct |
63 ms |
285776 KB |
ok |
20 |
Correct |
63 ms |
285772 KB |
ok |
21 |
Correct |
61 ms |
285780 KB |
ok |
22 |
Correct |
62 ms |
285776 KB |
ok |
23 |
Correct |
61 ms |
285776 KB |
ok |
24 |
Correct |
62 ms |
286036 KB |
ok |
25 |
Correct |
63 ms |
285776 KB |
ok |
26 |
Correct |
63 ms |
285800 KB |
ok |
27 |
Correct |
63 ms |
285780 KB |
ok |
28 |
Correct |
62 ms |
285776 KB |
ok |
29 |
Correct |
61 ms |
285776 KB |
ok |
30 |
Correct |
63 ms |
285932 KB |
ok |
31 |
Correct |
62 ms |
286036 KB |
ok |
32 |
Correct |
64 ms |
286036 KB |
ok |
33 |
Correct |
64 ms |
286032 KB |
ok |
34 |
Correct |
66 ms |
286036 KB |
ok |
35 |
Correct |
62 ms |
286032 KB |
ok |
36 |
Correct |
64 ms |
285828 KB |
ok |
37 |
Correct |
63 ms |
286040 KB |
ok |
38 |
Correct |
62 ms |
286032 KB |
ok |
39 |
Correct |
62 ms |
286040 KB |
ok |
40 |
Correct |
63 ms |
286240 KB |
ok |
41 |
Correct |
63 ms |
286032 KB |
ok |
42 |
Correct |
3474 ms |
1053736 KB |
ok |
43 |
Correct |
3495 ms |
1054032 KB |
ok |
44 |
Correct |
3500 ms |
1053996 KB |
ok |
45 |
Correct |
3442 ms |
1053972 KB |
ok |
46 |
Correct |
3654 ms |
1054064 KB |
ok |
47 |
Correct |
3471 ms |
1053988 KB |
ok |
48 |
Correct |
3508 ms |
1054280 KB |
ok |
49 |
Correct |
3536 ms |
1054092 KB |
ok |
50 |
Correct |
3407 ms |
1054056 KB |
ok |
51 |
Correct |
3475 ms |
1054252 KB |
ok |
52 |
Correct |
3489 ms |
1054020 KB |
ok |
53 |
Correct |
3462 ms |
1053968 KB |
ok |
54 |
Correct |
3444 ms |
1053788 KB |
ok |
55 |
Correct |
3444 ms |
1053828 KB |
ok |
56 |
Correct |
3394 ms |
1053824 KB |
ok |
57 |
Correct |
3489 ms |
1054104 KB |
ok |
58 |
Correct |
3443 ms |
1053988 KB |
ok |
59 |
Correct |
3466 ms |
1053836 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
100 ms |
285776 KB |
ok |
2 |
Correct |
62 ms |
285780 KB |
ok |
3 |
Correct |
60 ms |
285812 KB |
ok |
4 |
Correct |
61 ms |
285776 KB |
ok |
5 |
Correct |
62 ms |
285780 KB |
ok |
6 |
Correct |
62 ms |
285780 KB |
ok |
7 |
Correct |
61 ms |
285780 KB |
ok |
8 |
Correct |
79 ms |
293884 KB |
ok |
9 |
Correct |
3851 ms |
1053820 KB |
ok |
10 |
Correct |
637 ms |
525140 KB |
ok |
11 |
Correct |
61 ms |
285788 KB |
ok |
12 |
Correct |
64 ms |
285780 KB |
ok |
13 |
Correct |
63 ms |
285780 KB |
ok |
14 |
Correct |
67 ms |
285776 KB |
ok |
15 |
Correct |
62 ms |
286016 KB |
ok |
16 |
Correct |
63 ms |
285592 KB |
ok |
17 |
Correct |
63 ms |
285780 KB |
ok |
18 |
Correct |
62 ms |
285776 KB |
ok |
19 |
Correct |
62 ms |
285776 KB |
ok |
20 |
Correct |
63 ms |
285664 KB |
ok |
21 |
Correct |
66 ms |
285776 KB |
ok |
22 |
Correct |
62 ms |
285684 KB |
ok |
23 |
Correct |
64 ms |
285780 KB |
ok |
24 |
Correct |
63 ms |
285776 KB |
ok |
25 |
Correct |
63 ms |
285772 KB |
ok |
26 |
Correct |
61 ms |
285780 KB |
ok |
27 |
Correct |
62 ms |
285776 KB |
ok |
28 |
Correct |
61 ms |
285776 KB |
ok |
29 |
Correct |
62 ms |
286036 KB |
ok |
30 |
Correct |
63 ms |
285776 KB |
ok |
31 |
Correct |
63 ms |
285800 KB |
ok |
32 |
Correct |
63 ms |
285780 KB |
ok |
33 |
Correct |
62 ms |
285776 KB |
ok |
34 |
Correct |
61 ms |
285776 KB |
ok |
35 |
Correct |
63 ms |
285932 KB |
ok |
36 |
Correct |
62 ms |
286036 KB |
ok |
37 |
Correct |
64 ms |
286036 KB |
ok |
38 |
Correct |
64 ms |
286032 KB |
ok |
39 |
Correct |
66 ms |
286036 KB |
ok |
40 |
Correct |
62 ms |
286032 KB |
ok |
41 |
Correct |
64 ms |
285828 KB |
ok |
42 |
Correct |
63 ms |
286040 KB |
ok |
43 |
Correct |
62 ms |
286032 KB |
ok |
44 |
Correct |
62 ms |
286040 KB |
ok |
45 |
Correct |
63 ms |
286240 KB |
ok |
46 |
Correct |
63 ms |
286032 KB |
ok |
47 |
Correct |
3474 ms |
1053736 KB |
ok |
48 |
Correct |
3495 ms |
1054032 KB |
ok |
49 |
Correct |
3500 ms |
1053996 KB |
ok |
50 |
Correct |
3442 ms |
1053972 KB |
ok |
51 |
Correct |
3654 ms |
1054064 KB |
ok |
52 |
Correct |
3471 ms |
1053988 KB |
ok |
53 |
Correct |
3508 ms |
1054280 KB |
ok |
54 |
Correct |
3536 ms |
1054092 KB |
ok |
55 |
Correct |
3407 ms |
1054056 KB |
ok |
56 |
Correct |
3475 ms |
1054252 KB |
ok |
57 |
Correct |
3489 ms |
1054020 KB |
ok |
58 |
Correct |
3462 ms |
1053968 KB |
ok |
59 |
Correct |
3444 ms |
1053788 KB |
ok |
60 |
Correct |
3444 ms |
1053828 KB |
ok |
61 |
Correct |
3394 ms |
1053824 KB |
ok |
62 |
Correct |
3489 ms |
1054104 KB |
ok |
63 |
Correct |
3443 ms |
1053988 KB |
ok |
64 |
Correct |
3466 ms |
1053836 KB |
ok |
65 |
Partially correct |
656 ms |
526932 KB |
partial |
66 |
Partially correct |
741 ms |
527056 KB |
partial |
67 |
Partially correct |
658 ms |
527028 KB |
partial |
68 |
Partially correct |
642 ms |
526928 KB |
partial |
69 |
Partially correct |
640 ms |
527184 KB |
partial |
70 |
Partially correct |
646 ms |
527184 KB |
partial |
71 |
Partially correct |
633 ms |
526960 KB |
partial |
72 |
Partially correct |
638 ms |
526980 KB |
partial |
73 |
Correct |
658 ms |
527156 KB |
ok |
74 |
Correct |
665 ms |
527184 KB |
ok |
75 |
Correct |
666 ms |
527352 KB |
ok |
76 |
Correct |
638 ms |
527084 KB |
ok |
77 |
Partially correct |
642 ms |
526932 KB |
partial |
78 |
Partially correct |
630 ms |
527428 KB |
partial |
79 |
Partially correct |
638 ms |
526928 KB |
partial |
80 |
Partially correct |
621 ms |
527064 KB |
partial |
81 |
Partially correct |
631 ms |
527060 KB |
partial |
82 |
Partially correct |
625 ms |
526964 KB |
partial |
83 |
Partially correct |
624 ms |
526928 KB |
partial |
84 |
Partially correct |
619 ms |
526840 KB |
partial |
85 |
Partially correct |
634 ms |
527060 KB |
partial |
86 |
Partially correct |
625 ms |
526900 KB |
partial |
87 |
Correct |
634 ms |
527064 KB |
ok |
88 |
Partially correct |
633 ms |
527064 KB |
partial |
89 |
Partially correct |
627 ms |
527184 KB |
partial |
90 |
Partially correct |
631 ms |
527188 KB |
partial |
91 |
Partially correct |
627 ms |
526932 KB |
partial |
92 |
Partially correct |
640 ms |
527156 KB |
partial |
93 |
Partially correct |
634 ms |
527332 KB |
partial |
94 |
Partially correct |
617 ms |
527188 KB |
partial |
95 |
Partially correct |
621 ms |
526956 KB |
partial |
96 |
Partially correct |
628 ms |
526972 KB |
partial |
97 |
Partially correct |
618 ms |
527208 KB |
partial |
98 |
Partially correct |
631 ms |
526832 KB |
partial |
99 |
Correct |
631 ms |
527288 KB |
ok |
100 |
Partially correct |
624 ms |
526956 KB |
partial |
101 |
Partially correct |
629 ms |
527096 KB |
partial |
102 |
Partially correct |
615 ms |
527056 KB |
partial |
103 |
Partially correct |
626 ms |
526928 KB |
partial |
104 |
Partially correct |
618 ms |
527060 KB |
partial |
105 |
Partially correct |
614 ms |
526940 KB |
partial |
106 |
Partially correct |
621 ms |
527168 KB |
partial |
107 |
Correct |
622 ms |
526824 KB |
ok |
108 |
Partially correct |
628 ms |
526984 KB |
partial |
109 |
Correct |
751 ms |
519512 KB |
ok |