#include "soccer.h"
#include <bits/stdc++.h>
using namespace std;
const int mxn=2006;
int n,ans,s[mxn][mxn],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);
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]=y-x;
}
for (int j=i+1;j<=n;j++){
dp[i][j]+=max(dp[i+1][j],dp[i][j-1]);
ans=max(ans,dp[i][j]);
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
1 ms |
348 KB |
ok |
6 |
Correct |
1 ms |
344 KB |
ok |
7 |
Correct |
6 ms |
2904 KB |
ok |
8 |
Correct |
417 ms |
11404 KB |
ok |
9 |
Correct |
340 ms |
62748 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
1 ms |
348 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
1 ms |
348 KB |
ok |
9 |
Correct |
0 ms |
348 KB |
ok |
10 |
Correct |
0 ms |
348 KB |
ok |
11 |
Correct |
1 ms |
348 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Correct |
1 ms |
348 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Correct |
1 ms |
348 KB |
ok |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Correct |
1 ms |
348 KB |
ok |
10 |
Correct |
0 ms |
348 KB |
ok |
11 |
Correct |
0 ms |
348 KB |
ok |
12 |
Correct |
1 ms |
348 KB |
ok |
13 |
Correct |
0 ms |
348 KB |
ok |
14 |
Correct |
1 ms |
348 KB |
ok |
15 |
Correct |
0 ms |
348 KB |
ok |
16 |
Correct |
0 ms |
348 KB |
ok |
17 |
Correct |
1 ms |
344 KB |
ok |
18 |
Correct |
0 ms |
348 KB |
ok |
19 |
Correct |
1 ms |
344 KB |
ok |
20 |
Correct |
1 ms |
348 KB |
ok |
21 |
Correct |
0 ms |
348 KB |
ok |
22 |
Correct |
0 ms |
348 KB |
ok |
23 |
Correct |
0 ms |
348 KB |
ok |
24 |
Correct |
1 ms |
348 KB |
ok |
25 |
Correct |
0 ms |
348 KB |
ok |
26 |
Correct |
0 ms |
348 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Correct |
1 ms |
348 KB |
ok |
10 |
Correct |
0 ms |
348 KB |
ok |
11 |
Correct |
1 ms |
348 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Correct |
0 ms |
348 KB |
ok |
14 |
Correct |
1 ms |
348 KB |
ok |
15 |
Correct |
0 ms |
348 KB |
ok |
16 |
Correct |
1 ms |
348 KB |
ok |
17 |
Correct |
0 ms |
348 KB |
ok |
18 |
Correct |
0 ms |
348 KB |
ok |
19 |
Correct |
1 ms |
344 KB |
ok |
20 |
Correct |
0 ms |
348 KB |
ok |
21 |
Correct |
1 ms |
344 KB |
ok |
22 |
Correct |
1 ms |
348 KB |
ok |
23 |
Correct |
0 ms |
348 KB |
ok |
24 |
Correct |
0 ms |
348 KB |
ok |
25 |
Correct |
0 ms |
348 KB |
ok |
26 |
Correct |
1 ms |
348 KB |
ok |
27 |
Correct |
0 ms |
348 KB |
ok |
28 |
Correct |
0 ms |
348 KB |
ok |
29 |
Correct |
1 ms |
344 KB |
ok |
30 |
Correct |
1 ms |
2652 KB |
ok |
31 |
Correct |
1 ms |
2652 KB |
ok |
32 |
Correct |
1 ms |
2652 KB |
ok |
33 |
Correct |
1 ms |
2652 KB |
ok |
34 |
Correct |
1 ms |
2652 KB |
ok |
35 |
Correct |
1 ms |
2652 KB |
ok |
36 |
Correct |
1 ms |
2652 KB |
ok |
37 |
Correct |
1 ms |
2652 KB |
ok |
38 |
Correct |
1 ms |
2648 KB |
ok |
39 |
Correct |
1 ms |
2652 KB |
ok |
40 |
Correct |
1 ms |
2652 KB |
ok |
41 |
Correct |
1 ms |
2648 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Correct |
1 ms |
348 KB |
ok |
10 |
Correct |
0 ms |
348 KB |
ok |
11 |
Correct |
1 ms |
348 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Correct |
0 ms |
348 KB |
ok |
14 |
Correct |
1 ms |
348 KB |
ok |
15 |
Correct |
0 ms |
348 KB |
ok |
16 |
Correct |
1 ms |
348 KB |
ok |
17 |
Correct |
0 ms |
348 KB |
ok |
18 |
Correct |
0 ms |
348 KB |
ok |
19 |
Correct |
1 ms |
344 KB |
ok |
20 |
Correct |
0 ms |
348 KB |
ok |
21 |
Correct |
1 ms |
344 KB |
ok |
22 |
Correct |
1 ms |
348 KB |
ok |
23 |
Correct |
0 ms |
348 KB |
ok |
24 |
Correct |
0 ms |
348 KB |
ok |
25 |
Correct |
0 ms |
348 KB |
ok |
26 |
Correct |
1 ms |
348 KB |
ok |
27 |
Correct |
0 ms |
348 KB |
ok |
28 |
Correct |
0 ms |
348 KB |
ok |
29 |
Correct |
1 ms |
344 KB |
ok |
30 |
Correct |
1 ms |
2652 KB |
ok |
31 |
Correct |
1 ms |
2652 KB |
ok |
32 |
Correct |
1 ms |
2652 KB |
ok |
33 |
Correct |
1 ms |
2652 KB |
ok |
34 |
Correct |
1 ms |
2652 KB |
ok |
35 |
Correct |
1 ms |
2652 KB |
ok |
36 |
Correct |
1 ms |
2652 KB |
ok |
37 |
Correct |
1 ms |
2652 KB |
ok |
38 |
Correct |
1 ms |
2648 KB |
ok |
39 |
Correct |
1 ms |
2652 KB |
ok |
40 |
Correct |
1 ms |
2652 KB |
ok |
41 |
Correct |
1 ms |
2648 KB |
ok |
42 |
Correct |
427 ms |
11404 KB |
ok |
43 |
Correct |
385 ms |
11404 KB |
ok |
44 |
Correct |
427 ms |
11404 KB |
ok |
45 |
Correct |
438 ms |
11604 KB |
ok |
46 |
Correct |
393 ms |
11408 KB |
ok |
47 |
Correct |
444 ms |
11404 KB |
ok |
48 |
Correct |
411 ms |
11408 KB |
ok |
49 |
Correct |
434 ms |
11400 KB |
ok |
50 |
Correct |
432 ms |
11404 KB |
ok |
51 |
Correct |
385 ms |
11352 KB |
ok |
52 |
Correct |
372 ms |
11404 KB |
ok |
53 |
Correct |
403 ms |
11356 KB |
ok |
54 |
Correct |
373 ms |
11408 KB |
ok |
55 |
Correct |
388 ms |
11404 KB |
ok |
56 |
Correct |
420 ms |
11420 KB |
ok |
57 |
Correct |
428 ms |
11404 KB |
ok |
58 |
Correct |
442 ms |
11404 KB |
ok |
59 |
Correct |
412 ms |
11356 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
1 ms |
348 KB |
ok |
7 |
Correct |
1 ms |
344 KB |
ok |
8 |
Correct |
6 ms |
2904 KB |
ok |
9 |
Correct |
417 ms |
11404 KB |
ok |
10 |
Correct |
340 ms |
62748 KB |
ok |
11 |
Correct |
0 ms |
348 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Correct |
0 ms |
348 KB |
ok |
14 |
Correct |
1 ms |
348 KB |
ok |
15 |
Correct |
0 ms |
348 KB |
ok |
16 |
Correct |
1 ms |
348 KB |
ok |
17 |
Correct |
0 ms |
348 KB |
ok |
18 |
Correct |
0 ms |
348 KB |
ok |
19 |
Correct |
1 ms |
348 KB |
ok |
20 |
Correct |
0 ms |
348 KB |
ok |
21 |
Correct |
1 ms |
348 KB |
ok |
22 |
Correct |
0 ms |
348 KB |
ok |
23 |
Correct |
0 ms |
348 KB |
ok |
24 |
Correct |
1 ms |
344 KB |
ok |
25 |
Correct |
0 ms |
348 KB |
ok |
26 |
Correct |
1 ms |
344 KB |
ok |
27 |
Correct |
1 ms |
348 KB |
ok |
28 |
Correct |
0 ms |
348 KB |
ok |
29 |
Correct |
0 ms |
348 KB |
ok |
30 |
Correct |
0 ms |
348 KB |
ok |
31 |
Correct |
1 ms |
348 KB |
ok |
32 |
Correct |
0 ms |
348 KB |
ok |
33 |
Correct |
0 ms |
348 KB |
ok |
34 |
Correct |
1 ms |
344 KB |
ok |
35 |
Correct |
1 ms |
2652 KB |
ok |
36 |
Correct |
1 ms |
2652 KB |
ok |
37 |
Correct |
1 ms |
2652 KB |
ok |
38 |
Correct |
1 ms |
2652 KB |
ok |
39 |
Correct |
1 ms |
2652 KB |
ok |
40 |
Correct |
1 ms |
2652 KB |
ok |
41 |
Correct |
1 ms |
2652 KB |
ok |
42 |
Correct |
1 ms |
2652 KB |
ok |
43 |
Correct |
1 ms |
2648 KB |
ok |
44 |
Correct |
1 ms |
2652 KB |
ok |
45 |
Correct |
1 ms |
2652 KB |
ok |
46 |
Correct |
1 ms |
2648 KB |
ok |
47 |
Correct |
427 ms |
11404 KB |
ok |
48 |
Correct |
385 ms |
11404 KB |
ok |
49 |
Correct |
427 ms |
11404 KB |
ok |
50 |
Correct |
438 ms |
11604 KB |
ok |
51 |
Correct |
393 ms |
11408 KB |
ok |
52 |
Correct |
444 ms |
11404 KB |
ok |
53 |
Correct |
411 ms |
11408 KB |
ok |
54 |
Correct |
434 ms |
11400 KB |
ok |
55 |
Correct |
432 ms |
11404 KB |
ok |
56 |
Correct |
385 ms |
11352 KB |
ok |
57 |
Correct |
372 ms |
11404 KB |
ok |
58 |
Correct |
403 ms |
11356 KB |
ok |
59 |
Correct |
373 ms |
11408 KB |
ok |
60 |
Correct |
388 ms |
11404 KB |
ok |
61 |
Correct |
420 ms |
11420 KB |
ok |
62 |
Correct |
428 ms |
11404 KB |
ok |
63 |
Correct |
442 ms |
11404 KB |
ok |
64 |
Correct |
412 ms |
11356 KB |
ok |
65 |
Partially correct |
243 ms |
62592 KB |
partial |
66 |
Partially correct |
269 ms |
62748 KB |
partial |
67 |
Partially correct |
350 ms |
62708 KB |
partial |
68 |
Partially correct |
250 ms |
62544 KB |
partial |
69 |
Partially correct |
272 ms |
62748 KB |
partial |
70 |
Partially correct |
244 ms |
63024 KB |
partial |
71 |
Partially correct |
252 ms |
62752 KB |
partial |
72 |
Partially correct |
241 ms |
62512 KB |
partial |
73 |
Correct |
254 ms |
62700 KB |
ok |
74 |
Correct |
250 ms |
62752 KB |
ok |
75 |
Correct |
251 ms |
62700 KB |
ok |
76 |
Correct |
260 ms |
62808 KB |
ok |
77 |
Partially correct |
255 ms |
62516 KB |
partial |
78 |
Partially correct |
243 ms |
62548 KB |
partial |
79 |
Partially correct |
251 ms |
62748 KB |
partial |
80 |
Partially correct |
243 ms |
62544 KB |
partial |
81 |
Partially correct |
241 ms |
62700 KB |
partial |
82 |
Partially correct |
371 ms |
62544 KB |
partial |
83 |
Partially correct |
254 ms |
62756 KB |
partial |
84 |
Partially correct |
256 ms |
62544 KB |
partial |
85 |
Partially correct |
252 ms |
62748 KB |
partial |
86 |
Partially correct |
282 ms |
62752 KB |
partial |
87 |
Correct |
246 ms |
62748 KB |
ok |
88 |
Partially correct |
256 ms |
62548 KB |
partial |
89 |
Partially correct |
303 ms |
62756 KB |
partial |
90 |
Partially correct |
250 ms |
62548 KB |
partial |
91 |
Partially correct |
241 ms |
62760 KB |
partial |
92 |
Partially correct |
255 ms |
62616 KB |
partial |
93 |
Partially correct |
245 ms |
62548 KB |
partial |
94 |
Partially correct |
257 ms |
62760 KB |
partial |
95 |
Partially correct |
259 ms |
62752 KB |
partial |
96 |
Partially correct |
242 ms |
62752 KB |
partial |
97 |
Partially correct |
249 ms |
62548 KB |
partial |
98 |
Partially correct |
244 ms |
62740 KB |
partial |
99 |
Correct |
245 ms |
62508 KB |
ok |
100 |
Partially correct |
239 ms |
62592 KB |
partial |
101 |
Partially correct |
240 ms |
62548 KB |
partial |
102 |
Partially correct |
241 ms |
62700 KB |
partial |
103 |
Partially correct |
242 ms |
62548 KB |
partial |
104 |
Partially correct |
295 ms |
62776 KB |
partial |
105 |
Partially correct |
264 ms |
62760 KB |
partial |
106 |
Partially correct |
248 ms |
62756 KB |
partial |
107 |
Correct |
247 ms |
62544 KB |
ok |
108 |
Partially correct |
282 ms |
62776 KB |
partial |
109 |
Correct |
258 ms |
62588 KB |
ok |