#include <bits/stdc++.h>
using namespace std;
int biggest_stadium(int n, vector<vector<int>> f) {
vector<vector<int>> up(n, vector<int>(n)), down(n, vector<int>(n)), left(n, vector<int>(n)), right(n, vector<int>(n));
for(int x=0;x<n;x++) {
up[0][x] = 1 - f[0][x];
for (int y = 1; y < n; y++) {
if (f[y][x])
up[y][x] = 0;
else
up[y][x] = up[y - 1][x] + 1;
}
down[n - 1][x] = 1 - f[n - 1][x];
for (int y = n - 2; y >= 0; y--) {
if (f[y][x])
down[y][x] = 0;
else
down[y][x] = down[y + 1][x] + 1;
}
}
for(int y=0;y<n;y++) {
left[y][0] = 1 - f[y][0];
for (int x = 1; x < n; x++) {
if (f[y][x])
left[y][x] = 0;
else
left[y][x] = left[y][x - 1] + 1;
}
right[y][n - 1] = 1 - f[y][n - 1];
for (int x = n - 2; x >= 0; x--) {
if (f[y][x])
right[y][x] = 0;
else
right[y][x] = right[y][x + 1] + 1;
}
}
int result = 0;
for(int y=0;y<n;y++) {
for(int x=0;x<n;x++) {
if (f[y][x]) {
continue;
}
int count1 = 0;
int l = 0, r = INT_MAX;
vector<pair<int,int>> intervals;
for (int y2 = y; y2 < y + down[y][x]; y2++) {
l = max(l, x - left[y2][x] + 1);
r = min(r, x + right[y2][x] - 1);
intervals.push_back({ l, r });
count1 += r - l + 1;
}
l = x - left[y][x] + 1;
r = x + right[y][x] - 1;
for (int y2 = y - 1; y2 > y - up[y][x]; y2--) {
l = max(l, x - left[y2][x] + 1);
r = min(r, x + right[y2][x] - 1);
for (auto [li, ri] : intervals) {
if (r < ri)
l = max(l, li);
if (l > li)
r = min(r, ri);
}
if (r < l)
break;
count1 += r - l + 1;
}
int count = count1;
result = max(result, count);
}
}
return result;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
344 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
344 KB |
ok |
6 |
Correct |
0 ms |
520 KB |
ok |
7 |
Correct |
22 ms |
604 KB |
ok |
8 |
Execution timed out |
4514 ms |
6744 KB |
Time limit exceeded |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
344 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 |
408 KB |
ok |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Correct |
0 ms |
348 KB |
ok |
10 |
Correct |
1 ms |
348 KB |
ok |
11 |
Correct |
0 ms |
348 KB |
ok |
12 |
Correct |
0 ms |
344 KB |
ok |
13 |
Correct |
0 ms |
348 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
344 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
344 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 |
408 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 |
0 ms |
344 KB |
ok |
14 |
Correct |
0 ms |
348 KB |
ok |
15 |
Correct |
0 ms |
344 KB |
ok |
16 |
Correct |
0 ms |
348 KB |
ok |
17 |
Correct |
0 ms |
348 KB |
ok |
18 |
Correct |
0 ms |
344 KB |
ok |
19 |
Correct |
0 ms |
348 KB |
ok |
20 |
Correct |
0 ms |
348 KB |
ok |
21 |
Correct |
0 ms |
344 KB |
ok |
22 |
Correct |
0 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 |
0 ms |
344 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
344 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
344 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
344 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Correct |
0 ms |
348 KB |
ok |
10 |
Correct |
0 ms |
408 KB |
ok |
11 |
Correct |
0 ms |
348 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Correct |
1 ms |
348 KB |
ok |
14 |
Correct |
0 ms |
348 KB |
ok |
15 |
Correct |
0 ms |
344 KB |
ok |
16 |
Correct |
0 ms |
348 KB |
ok |
17 |
Correct |
0 ms |
344 KB |
ok |
18 |
Correct |
0 ms |
348 KB |
ok |
19 |
Correct |
0 ms |
348 KB |
ok |
20 |
Correct |
0 ms |
344 KB |
ok |
21 |
Correct |
0 ms |
348 KB |
ok |
22 |
Correct |
0 ms |
348 KB |
ok |
23 |
Correct |
0 ms |
344 KB |
ok |
24 |
Correct |
0 ms |
348 KB |
ok |
25 |
Correct |
0 ms |
348 KB |
ok |
26 |
Correct |
0 ms |
348 KB |
ok |
27 |
Correct |
0 ms |
348 KB |
ok |
28 |
Correct |
0 ms |
344 KB |
ok |
29 |
Correct |
0 ms |
348 KB |
ok |
30 |
Correct |
1 ms |
348 KB |
ok |
31 |
Correct |
1 ms |
348 KB |
ok |
32 |
Correct |
0 ms |
344 KB |
ok |
33 |
Correct |
0 ms |
348 KB |
ok |
34 |
Correct |
0 ms |
348 KB |
ok |
35 |
Correct |
0 ms |
348 KB |
ok |
36 |
Correct |
0 ms |
348 KB |
ok |
37 |
Correct |
0 ms |
388 KB |
ok |
38 |
Partially correct |
1 ms |
348 KB |
partial |
39 |
Partially correct |
0 ms |
348 KB |
partial |
40 |
Correct |
1 ms |
348 KB |
ok |
41 |
Correct |
1 ms |
348 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
344 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
344 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
344 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Correct |
0 ms |
348 KB |
ok |
10 |
Correct |
0 ms |
408 KB |
ok |
11 |
Correct |
0 ms |
348 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Correct |
1 ms |
348 KB |
ok |
14 |
Correct |
0 ms |
348 KB |
ok |
15 |
Correct |
0 ms |
344 KB |
ok |
16 |
Correct |
0 ms |
348 KB |
ok |
17 |
Correct |
0 ms |
344 KB |
ok |
18 |
Correct |
0 ms |
348 KB |
ok |
19 |
Correct |
0 ms |
348 KB |
ok |
20 |
Correct |
0 ms |
344 KB |
ok |
21 |
Correct |
0 ms |
348 KB |
ok |
22 |
Correct |
0 ms |
348 KB |
ok |
23 |
Correct |
0 ms |
344 KB |
ok |
24 |
Correct |
0 ms |
348 KB |
ok |
25 |
Correct |
0 ms |
348 KB |
ok |
26 |
Correct |
0 ms |
348 KB |
ok |
27 |
Correct |
0 ms |
348 KB |
ok |
28 |
Correct |
0 ms |
344 KB |
ok |
29 |
Correct |
0 ms |
348 KB |
ok |
30 |
Correct |
1 ms |
348 KB |
ok |
31 |
Correct |
1 ms |
348 KB |
ok |
32 |
Correct |
0 ms |
344 KB |
ok |
33 |
Correct |
0 ms |
348 KB |
ok |
34 |
Correct |
0 ms |
348 KB |
ok |
35 |
Correct |
0 ms |
348 KB |
ok |
36 |
Correct |
0 ms |
348 KB |
ok |
37 |
Correct |
0 ms |
388 KB |
ok |
38 |
Partially correct |
1 ms |
348 KB |
partial |
39 |
Partially correct |
0 ms |
348 KB |
partial |
40 |
Correct |
1 ms |
348 KB |
ok |
41 |
Correct |
1 ms |
348 KB |
ok |
42 |
Correct |
78 ms |
6748 KB |
ok |
43 |
Correct |
45 ms |
6748 KB |
ok |
44 |
Partially correct |
1640 ms |
6892 KB |
partial |
45 |
Partially correct |
3523 ms |
6792 KB |
partial |
46 |
Partially correct |
193 ms |
6744 KB |
partial |
47 |
Execution timed out |
4575 ms |
6748 KB |
Time limit exceeded |
48 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
344 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
344 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
344 KB |
ok |
7 |
Correct |
0 ms |
520 KB |
ok |
8 |
Correct |
22 ms |
604 KB |
ok |
9 |
Execution timed out |
4514 ms |
6744 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |