#include "soccer.h"
#include <bits/stdc++.h>
using namespace std;
const int MAX = 2005;
int n, a[MAX][MAX];
int L[MAX][MAX];
int R[MAX][MAX];
int res;
map<array<int, 5>, bool> was;
void rec(int xl, int xr, int yl, int yr, int cur) {
if (was[{xl, xr, yl, yr, cur}]) {
return;
}
res = max(res, cur);
was[{xl, xr, yl, yr}] = true;
if (xl > 0) {
// up
for (int i = yl; i <= yr; i++) {
if (a[xl - 1][i] == 1) {
continue;
}
int t = min(yr, R[xl - 1][i]);
rec(xl - 1, xr, i, t, cur + t - i + 1);
}
}
if (xr + 1 < n) {
// down
for (int i = yl; i <= yr; i++) {
if (a[xr + 1][i] == 1) {
continue;
}
int t = min(yr, R[xr + 1][i]);
rec(xl, xr + 1, i, t, cur + t - i + 1);
}
}
}
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++) {
a[i][j] = F[i][j];
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (a[i][j] == 1) {
continue;
}
int p = j;
while (p + 1 < n && a[i][p + 1] == 0) {
p += 1;
}
for (int k = j; k <= p; k++) {
L[i][k] = j;
R[i][k] = p;
}
j = p;
}
}
res = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (a[i][j] == 1) {
continue;
}
if (j == 0 || a[i][j - 1] == 1) {
rec(i, i, j, R[i][j], R[i][j] - j + 1);
}
}
}
return res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4600 KB |
ok |
2 |
Correct |
1 ms |
4444 KB |
ok |
3 |
Correct |
665 ms |
4708 KB |
ok |
4 |
Correct |
3336 ms |
4944 KB |
ok |
5 |
Correct |
1 ms |
4440 KB |
ok |
6 |
Correct |
1 ms |
4440 KB |
ok |
7 |
Execution timed out |
4548 ms |
8528 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4600 KB |
ok |
2 |
Correct |
1 ms |
4444 KB |
ok |
3 |
Correct |
1 ms |
4444 KB |
ok |
4 |
Correct |
1 ms |
4444 KB |
ok |
5 |
Correct |
1 ms |
4444 KB |
ok |
6 |
Correct |
1 ms |
4444 KB |
ok |
7 |
Correct |
1 ms |
4444 KB |
ok |
8 |
Correct |
1 ms |
4444 KB |
ok |
9 |
Correct |
1 ms |
4444 KB |
ok |
10 |
Correct |
1 ms |
4444 KB |
ok |
11 |
Correct |
1 ms |
4444 KB |
ok |
12 |
Correct |
1 ms |
4700 KB |
ok |
13 |
Correct |
1 ms |
4444 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
ok |
2 |
Correct |
1 ms |
4600 KB |
ok |
3 |
Correct |
1 ms |
4444 KB |
ok |
4 |
Correct |
1 ms |
4444 KB |
ok |
5 |
Correct |
1 ms |
4444 KB |
ok |
6 |
Correct |
1 ms |
4444 KB |
ok |
7 |
Correct |
1 ms |
4444 KB |
ok |
8 |
Correct |
1 ms |
4444 KB |
ok |
9 |
Correct |
1 ms |
4444 KB |
ok |
10 |
Correct |
1 ms |
4444 KB |
ok |
11 |
Correct |
1 ms |
4444 KB |
ok |
12 |
Correct |
1 ms |
4444 KB |
ok |
13 |
Correct |
1 ms |
4700 KB |
ok |
14 |
Correct |
1 ms |
4444 KB |
ok |
15 |
Correct |
5 ms |
4444 KB |
ok |
16 |
Correct |
3 ms |
4700 KB |
ok |
17 |
Correct |
1 ms |
4444 KB |
ok |
18 |
Correct |
1 ms |
4440 KB |
ok |
19 |
Correct |
1 ms |
4544 KB |
ok |
20 |
Correct |
1 ms |
4444 KB |
ok |
21 |
Correct |
1 ms |
4444 KB |
ok |
22 |
Correct |
1 ms |
4444 KB |
ok |
23 |
Correct |
1 ms |
4444 KB |
ok |
24 |
Correct |
1 ms |
4444 KB |
ok |
25 |
Correct |
1 ms |
4444 KB |
ok |
26 |
Correct |
1 ms |
4440 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
ok |
2 |
Correct |
1 ms |
4600 KB |
ok |
3 |
Correct |
1 ms |
4444 KB |
ok |
4 |
Correct |
665 ms |
4708 KB |
ok |
5 |
Correct |
3336 ms |
4944 KB |
ok |
6 |
Correct |
1 ms |
4444 KB |
ok |
7 |
Correct |
1 ms |
4444 KB |
ok |
8 |
Correct |
1 ms |
4444 KB |
ok |
9 |
Correct |
1 ms |
4444 KB |
ok |
10 |
Correct |
1 ms |
4444 KB |
ok |
11 |
Correct |
1 ms |
4444 KB |
ok |
12 |
Correct |
1 ms |
4444 KB |
ok |
13 |
Correct |
1 ms |
4444 KB |
ok |
14 |
Correct |
1 ms |
4444 KB |
ok |
15 |
Correct |
1 ms |
4700 KB |
ok |
16 |
Correct |
1 ms |
4444 KB |
ok |
17 |
Correct |
5 ms |
4444 KB |
ok |
18 |
Correct |
3 ms |
4700 KB |
ok |
19 |
Correct |
1 ms |
4444 KB |
ok |
20 |
Correct |
1 ms |
4440 KB |
ok |
21 |
Correct |
1 ms |
4544 KB |
ok |
22 |
Correct |
1 ms |
4444 KB |
ok |
23 |
Correct |
1 ms |
4444 KB |
ok |
24 |
Correct |
1 ms |
4444 KB |
ok |
25 |
Correct |
1 ms |
4444 KB |
ok |
26 |
Correct |
1 ms |
4444 KB |
ok |
27 |
Correct |
1 ms |
4444 KB |
ok |
28 |
Correct |
1 ms |
4440 KB |
ok |
29 |
Correct |
1 ms |
4444 KB |
ok |
30 |
Execution timed out |
4517 ms |
7880 KB |
Time limit exceeded |
31 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
ok |
2 |
Correct |
1 ms |
4600 KB |
ok |
3 |
Correct |
1 ms |
4444 KB |
ok |
4 |
Correct |
665 ms |
4708 KB |
ok |
5 |
Correct |
3336 ms |
4944 KB |
ok |
6 |
Correct |
1 ms |
4444 KB |
ok |
7 |
Correct |
1 ms |
4444 KB |
ok |
8 |
Correct |
1 ms |
4444 KB |
ok |
9 |
Correct |
1 ms |
4444 KB |
ok |
10 |
Correct |
1 ms |
4444 KB |
ok |
11 |
Correct |
1 ms |
4444 KB |
ok |
12 |
Correct |
1 ms |
4444 KB |
ok |
13 |
Correct |
1 ms |
4444 KB |
ok |
14 |
Correct |
1 ms |
4444 KB |
ok |
15 |
Correct |
1 ms |
4700 KB |
ok |
16 |
Correct |
1 ms |
4444 KB |
ok |
17 |
Correct |
5 ms |
4444 KB |
ok |
18 |
Correct |
3 ms |
4700 KB |
ok |
19 |
Correct |
1 ms |
4444 KB |
ok |
20 |
Correct |
1 ms |
4440 KB |
ok |
21 |
Correct |
1 ms |
4544 KB |
ok |
22 |
Correct |
1 ms |
4444 KB |
ok |
23 |
Correct |
1 ms |
4444 KB |
ok |
24 |
Correct |
1 ms |
4444 KB |
ok |
25 |
Correct |
1 ms |
4444 KB |
ok |
26 |
Correct |
1 ms |
4444 KB |
ok |
27 |
Correct |
1 ms |
4444 KB |
ok |
28 |
Correct |
1 ms |
4440 KB |
ok |
29 |
Correct |
1 ms |
4444 KB |
ok |
30 |
Execution timed out |
4517 ms |
7880 KB |
Time limit exceeded |
31 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
ok |
2 |
Correct |
1 ms |
4600 KB |
ok |
3 |
Correct |
1 ms |
4444 KB |
ok |
4 |
Correct |
665 ms |
4708 KB |
ok |
5 |
Correct |
3336 ms |
4944 KB |
ok |
6 |
Correct |
1 ms |
4440 KB |
ok |
7 |
Correct |
1 ms |
4440 KB |
ok |
8 |
Execution timed out |
4548 ms |
8528 KB |
Time limit exceeded |
9 |
Halted |
0 ms |
0 KB |
- |