#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];
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=0;k<=(n<501)*n;k++)
for (int i=n;i>=0;i--){
int x=(n>500?S:k),y=(n>500?S:k);
dp[i][i].push_back(0);
for (int j=n;j>i;j--){
while (x&&s[j][x-1]==s[i][x-1])
x--;
while (y<n&&s[j][y]==s[i][y])
y++;
dp[i][j].push_back(y-x);
}
for (int j=i+1;j<=n;j++){
dp[i][j][k]+=max(dp[i+1][j][k],dp[i][j-1][k]);
ans=max(ans,dp[i][j][k]);
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
39 ms |
94800 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
21 ms |
94808 KB |
ok |
2 |
Correct |
21 ms |
94812 KB |
ok |
3 |
Correct |
23 ms |
97036 KB |
ok |
4 |
Correct |
22 ms |
97048 KB |
ok |
5 |
Correct |
22 ms |
94980 KB |
ok |
6 |
Correct |
20 ms |
94812 KB |
ok |
7 |
Correct |
30 ms |
99828 KB |
ok |
8 |
Correct |
1358 ms |
356080 KB |
ok |
9 |
Correct |
342 ms |
211192 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
21 ms |
94808 KB |
ok |
2 |
Correct |
21 ms |
94812 KB |
ok |
3 |
Correct |
22 ms |
94948 KB |
ok |
4 |
Correct |
21 ms |
94812 KB |
ok |
5 |
Correct |
21 ms |
94808 KB |
ok |
6 |
Correct |
21 ms |
94812 KB |
ok |
7 |
Correct |
21 ms |
94812 KB |
ok |
8 |
Correct |
20 ms |
94844 KB |
ok |
9 |
Correct |
21 ms |
94956 KB |
ok |
10 |
Correct |
21 ms |
94868 KB |
ok |
11 |
Correct |
21 ms |
94932 KB |
ok |
12 |
Correct |
21 ms |
95064 KB |
ok |
13 |
Correct |
21 ms |
94856 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
39 ms |
94800 KB |
ok |
2 |
Correct |
21 ms |
94808 KB |
ok |
3 |
Correct |
21 ms |
94812 KB |
ok |
4 |
Correct |
22 ms |
94948 KB |
ok |
5 |
Correct |
21 ms |
94812 KB |
ok |
6 |
Correct |
21 ms |
94808 KB |
ok |
7 |
Correct |
21 ms |
94812 KB |
ok |
8 |
Correct |
21 ms |
94812 KB |
ok |
9 |
Correct |
20 ms |
94844 KB |
ok |
10 |
Correct |
21 ms |
94956 KB |
ok |
11 |
Correct |
21 ms |
94868 KB |
ok |
12 |
Correct |
21 ms |
94932 KB |
ok |
13 |
Correct |
21 ms |
95064 KB |
ok |
14 |
Correct |
21 ms |
94856 KB |
ok |
15 |
Correct |
21 ms |
94812 KB |
ok |
16 |
Correct |
21 ms |
94988 KB |
ok |
17 |
Correct |
21 ms |
94812 KB |
ok |
18 |
Correct |
20 ms |
94812 KB |
ok |
19 |
Correct |
23 ms |
95004 KB |
ok |
20 |
Correct |
21 ms |
94812 KB |
ok |
21 |
Correct |
21 ms |
94808 KB |
ok |
22 |
Correct |
23 ms |
94812 KB |
ok |
23 |
Correct |
21 ms |
94988 KB |
ok |
24 |
Correct |
21 ms |
94812 KB |
ok |
25 |
Correct |
20 ms |
95064 KB |
ok |
26 |
Correct |
21 ms |
94812 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
39 ms |
94800 KB |
ok |
2 |
Correct |
21 ms |
94808 KB |
ok |
3 |
Correct |
21 ms |
94812 KB |
ok |
4 |
Correct |
23 ms |
97036 KB |
ok |
5 |
Correct |
22 ms |
97048 KB |
ok |
6 |
Correct |
22 ms |
94948 KB |
ok |
7 |
Correct |
21 ms |
94812 KB |
ok |
8 |
Correct |
21 ms |
94808 KB |
ok |
9 |
Correct |
21 ms |
94812 KB |
ok |
10 |
Correct |
21 ms |
94812 KB |
ok |
11 |
Correct |
20 ms |
94844 KB |
ok |
12 |
Correct |
21 ms |
94956 KB |
ok |
13 |
Correct |
21 ms |
94868 KB |
ok |
14 |
Correct |
21 ms |
94932 KB |
ok |
15 |
Correct |
21 ms |
95064 KB |
ok |
16 |
Correct |
21 ms |
94856 KB |
ok |
17 |
Correct |
21 ms |
94812 KB |
ok |
18 |
Correct |
21 ms |
94988 KB |
ok |
19 |
Correct |
21 ms |
94812 KB |
ok |
20 |
Correct |
20 ms |
94812 KB |
ok |
21 |
Correct |
23 ms |
95004 KB |
ok |
22 |
Correct |
21 ms |
94812 KB |
ok |
23 |
Correct |
21 ms |
94808 KB |
ok |
24 |
Correct |
23 ms |
94812 KB |
ok |
25 |
Correct |
21 ms |
94988 KB |
ok |
26 |
Correct |
21 ms |
94812 KB |
ok |
27 |
Correct |
20 ms |
95064 KB |
ok |
28 |
Correct |
21 ms |
94812 KB |
ok |
29 |
Correct |
24 ms |
94812 KB |
ok |
30 |
Correct |
21 ms |
97116 KB |
ok |
31 |
Correct |
21 ms |
97116 KB |
ok |
32 |
Correct |
22 ms |
97112 KB |
ok |
33 |
Correct |
24 ms |
97156 KB |
ok |
34 |
Correct |
21 ms |
97112 KB |
ok |
35 |
Correct |
21 ms |
97116 KB |
ok |
36 |
Correct |
21 ms |
97116 KB |
ok |
37 |
Correct |
22 ms |
97112 KB |
ok |
38 |
Correct |
22 ms |
97036 KB |
ok |
39 |
Correct |
22 ms |
97116 KB |
ok |
40 |
Correct |
21 ms |
97112 KB |
ok |
41 |
Correct |
22 ms |
97160 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
39 ms |
94800 KB |
ok |
2 |
Correct |
21 ms |
94808 KB |
ok |
3 |
Correct |
21 ms |
94812 KB |
ok |
4 |
Correct |
23 ms |
97036 KB |
ok |
5 |
Correct |
22 ms |
97048 KB |
ok |
6 |
Correct |
22 ms |
94948 KB |
ok |
7 |
Correct |
21 ms |
94812 KB |
ok |
8 |
Correct |
21 ms |
94808 KB |
ok |
9 |
Correct |
21 ms |
94812 KB |
ok |
10 |
Correct |
21 ms |
94812 KB |
ok |
11 |
Correct |
20 ms |
94844 KB |
ok |
12 |
Correct |
21 ms |
94956 KB |
ok |
13 |
Correct |
21 ms |
94868 KB |
ok |
14 |
Correct |
21 ms |
94932 KB |
ok |
15 |
Correct |
21 ms |
95064 KB |
ok |
16 |
Correct |
21 ms |
94856 KB |
ok |
17 |
Correct |
21 ms |
94812 KB |
ok |
18 |
Correct |
21 ms |
94988 KB |
ok |
19 |
Correct |
21 ms |
94812 KB |
ok |
20 |
Correct |
20 ms |
94812 KB |
ok |
21 |
Correct |
23 ms |
95004 KB |
ok |
22 |
Correct |
21 ms |
94812 KB |
ok |
23 |
Correct |
21 ms |
94808 KB |
ok |
24 |
Correct |
23 ms |
94812 KB |
ok |
25 |
Correct |
21 ms |
94988 KB |
ok |
26 |
Correct |
21 ms |
94812 KB |
ok |
27 |
Correct |
20 ms |
95064 KB |
ok |
28 |
Correct |
21 ms |
94812 KB |
ok |
29 |
Correct |
24 ms |
94812 KB |
ok |
30 |
Correct |
21 ms |
97116 KB |
ok |
31 |
Correct |
21 ms |
97116 KB |
ok |
32 |
Correct |
22 ms |
97112 KB |
ok |
33 |
Correct |
24 ms |
97156 KB |
ok |
34 |
Correct |
21 ms |
97112 KB |
ok |
35 |
Correct |
21 ms |
97116 KB |
ok |
36 |
Correct |
21 ms |
97116 KB |
ok |
37 |
Correct |
22 ms |
97112 KB |
ok |
38 |
Correct |
22 ms |
97036 KB |
ok |
39 |
Correct |
22 ms |
97116 KB |
ok |
40 |
Correct |
21 ms |
97112 KB |
ok |
41 |
Correct |
22 ms |
97160 KB |
ok |
42 |
Correct |
1176 ms |
356224 KB |
ok |
43 |
Correct |
1238 ms |
356312 KB |
ok |
44 |
Correct |
1245 ms |
356148 KB |
ok |
45 |
Correct |
1287 ms |
356084 KB |
ok |
46 |
Correct |
1157 ms |
356084 KB |
ok |
47 |
Correct |
1413 ms |
356140 KB |
ok |
48 |
Correct |
1202 ms |
356192 KB |
ok |
49 |
Correct |
1244 ms |
356224 KB |
ok |
50 |
Correct |
1353 ms |
356200 KB |
ok |
51 |
Correct |
1271 ms |
355880 KB |
ok |
52 |
Correct |
1138 ms |
355980 KB |
ok |
53 |
Correct |
1149 ms |
355964 KB |
ok |
54 |
Correct |
1162 ms |
356172 KB |
ok |
55 |
Correct |
1179 ms |
356148 KB |
ok |
56 |
Correct |
1140 ms |
356088 KB |
ok |
57 |
Correct |
1335 ms |
356332 KB |
ok |
58 |
Correct |
1213 ms |
355964 KB |
ok |
59 |
Correct |
1212 ms |
355924 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
39 ms |
94800 KB |
ok |
2 |
Correct |
21 ms |
94808 KB |
ok |
3 |
Correct |
21 ms |
94812 KB |
ok |
4 |
Correct |
23 ms |
97036 KB |
ok |
5 |
Correct |
22 ms |
97048 KB |
ok |
6 |
Correct |
22 ms |
94980 KB |
ok |
7 |
Correct |
20 ms |
94812 KB |
ok |
8 |
Correct |
30 ms |
99828 KB |
ok |
9 |
Correct |
1358 ms |
356080 KB |
ok |
10 |
Correct |
342 ms |
211192 KB |
ok |
11 |
Correct |
22 ms |
94948 KB |
ok |
12 |
Correct |
21 ms |
94812 KB |
ok |
13 |
Correct |
21 ms |
94808 KB |
ok |
14 |
Correct |
21 ms |
94812 KB |
ok |
15 |
Correct |
21 ms |
94812 KB |
ok |
16 |
Correct |
20 ms |
94844 KB |
ok |
17 |
Correct |
21 ms |
94956 KB |
ok |
18 |
Correct |
21 ms |
94868 KB |
ok |
19 |
Correct |
21 ms |
94932 KB |
ok |
20 |
Correct |
21 ms |
95064 KB |
ok |
21 |
Correct |
21 ms |
94856 KB |
ok |
22 |
Correct |
21 ms |
94812 KB |
ok |
23 |
Correct |
21 ms |
94988 KB |
ok |
24 |
Correct |
21 ms |
94812 KB |
ok |
25 |
Correct |
20 ms |
94812 KB |
ok |
26 |
Correct |
23 ms |
95004 KB |
ok |
27 |
Correct |
21 ms |
94812 KB |
ok |
28 |
Correct |
21 ms |
94808 KB |
ok |
29 |
Correct |
23 ms |
94812 KB |
ok |
30 |
Correct |
21 ms |
94988 KB |
ok |
31 |
Correct |
21 ms |
94812 KB |
ok |
32 |
Correct |
20 ms |
95064 KB |
ok |
33 |
Correct |
21 ms |
94812 KB |
ok |
34 |
Correct |
24 ms |
94812 KB |
ok |
35 |
Correct |
21 ms |
97116 KB |
ok |
36 |
Correct |
21 ms |
97116 KB |
ok |
37 |
Correct |
22 ms |
97112 KB |
ok |
38 |
Correct |
24 ms |
97156 KB |
ok |
39 |
Correct |
21 ms |
97112 KB |
ok |
40 |
Correct |
21 ms |
97116 KB |
ok |
41 |
Correct |
21 ms |
97116 KB |
ok |
42 |
Correct |
22 ms |
97112 KB |
ok |
43 |
Correct |
22 ms |
97036 KB |
ok |
44 |
Correct |
22 ms |
97116 KB |
ok |
45 |
Correct |
21 ms |
97112 KB |
ok |
46 |
Correct |
22 ms |
97160 KB |
ok |
47 |
Correct |
1176 ms |
356224 KB |
ok |
48 |
Correct |
1238 ms |
356312 KB |
ok |
49 |
Correct |
1245 ms |
356148 KB |
ok |
50 |
Correct |
1287 ms |
356084 KB |
ok |
51 |
Correct |
1157 ms |
356084 KB |
ok |
52 |
Correct |
1413 ms |
356140 KB |
ok |
53 |
Correct |
1202 ms |
356192 KB |
ok |
54 |
Correct |
1244 ms |
356224 KB |
ok |
55 |
Correct |
1353 ms |
356200 KB |
ok |
56 |
Correct |
1271 ms |
355880 KB |
ok |
57 |
Correct |
1138 ms |
355980 KB |
ok |
58 |
Correct |
1149 ms |
355964 KB |
ok |
59 |
Correct |
1162 ms |
356172 KB |
ok |
60 |
Correct |
1179 ms |
356148 KB |
ok |
61 |
Correct |
1140 ms |
356088 KB |
ok |
62 |
Correct |
1335 ms |
356332 KB |
ok |
63 |
Correct |
1213 ms |
355964 KB |
ok |
64 |
Correct |
1212 ms |
355924 KB |
ok |
65 |
Partially correct |
358 ms |
210756 KB |
partial |
66 |
Partially correct |
352 ms |
210844 KB |
partial |
67 |
Partially correct |
357 ms |
210708 KB |
partial |
68 |
Partially correct |
351 ms |
210916 KB |
partial |
69 |
Partially correct |
342 ms |
210780 KB |
partial |
70 |
Partially correct |
346 ms |
210768 KB |
partial |
71 |
Partially correct |
384 ms |
210944 KB |
partial |
72 |
Partially correct |
348 ms |
211020 KB |
partial |
73 |
Correct |
384 ms |
211052 KB |
ok |
74 |
Correct |
368 ms |
210768 KB |
ok |
75 |
Correct |
360 ms |
210772 KB |
ok |
76 |
Correct |
346 ms |
211028 KB |
ok |
77 |
Partially correct |
345 ms |
210984 KB |
partial |
78 |
Partially correct |
340 ms |
210768 KB |
partial |
79 |
Partially correct |
348 ms |
210932 KB |
partial |
80 |
Partially correct |
344 ms |
210744 KB |
partial |
81 |
Partially correct |
349 ms |
210956 KB |
partial |
82 |
Partially correct |
356 ms |
210876 KB |
partial |
83 |
Partially correct |
349 ms |
210912 KB |
partial |
84 |
Partially correct |
372 ms |
211160 KB |
partial |
85 |
Partially correct |
346 ms |
210768 KB |
partial |
86 |
Partially correct |
356 ms |
211012 KB |
partial |
87 |
Correct |
352 ms |
210984 KB |
ok |
88 |
Partially correct |
346 ms |
210900 KB |
partial |
89 |
Partially correct |
353 ms |
210772 KB |
partial |
90 |
Partially correct |
346 ms |
210768 KB |
partial |
91 |
Partially correct |
348 ms |
210888 KB |
partial |
92 |
Partially correct |
344 ms |
210852 KB |
partial |
93 |
Partially correct |
363 ms |
210852 KB |
partial |
94 |
Partially correct |
401 ms |
210844 KB |
partial |
95 |
Partially correct |
360 ms |
210704 KB |
partial |
96 |
Partially correct |
353 ms |
210740 KB |
partial |
97 |
Partially correct |
346 ms |
210716 KB |
partial |
98 |
Partially correct |
338 ms |
210820 KB |
partial |
99 |
Correct |
370 ms |
210736 KB |
ok |
100 |
Partially correct |
360 ms |
210772 KB |
partial |
101 |
Partially correct |
345 ms |
210704 KB |
partial |
102 |
Partially correct |
355 ms |
210884 KB |
partial |
103 |
Partially correct |
336 ms |
210772 KB |
partial |
104 |
Partially correct |
339 ms |
210772 KB |
partial |
105 |
Partially correct |
366 ms |
210880 KB |
partial |
106 |
Partially correct |
345 ms |
210772 KB |
partial |
107 |
Correct |
348 ms |
211020 KB |
ok |
108 |
Partially correct |
341 ms |
210776 KB |
partial |
109 |
Correct |
344 ms |
204940 KB |
ok |