#include "soccer.h"
using namespace std;
int biggest_stadium(int n, vector<vector<int>> f)
{
vector<vector<int>> a(n+2, vector<int>(n+2, 1));
vector<vector<int>> u(n+2, vector<int>(n+2, 0));// how many empty up
vector<vector<int>> l(n+2, vector<int>(n+2, 0));// left
vector<vector<int>> r(n+2, vector<int>(n+2, 0));// right
vector<vector<int>> d(n+2, vector<int>(n+2, 0));// down
for (int i = 0; i < n; i++){
for (int j = 0; j < n; j++){
a[i+1][j+1] = f[i][j];
}
}
for (int i = 1; i <= n; i++){
for (int j = 1; j <= n; j++){
if (a[i][j]) continue;
l[i][j] = l[i][j - 1] + 1;
u[i][j] = u[i - 1][j] + 1;
}
}
for (int i = n; i >= 1; i--){
for (int j = n; j >= 1; j--){
if (a[i][j]) continue;
r[i][j] = r[i][j + 1] + 1;
d[i][j] = d[i + 1][j] + 1;
}
}
int ans = 0;
for (int i = 1; i <= n; i++){
for (int j = 1; j <= n; j++){
if (a[i][j]) continue;
int siz = 0;
int up = u[i][j];
int dw = d[i][j];
for (int k = j; k < j + r[i][j]; k++){
up = min(up, u[i][k]);
dw = min(dw, d[i][k]);
siz += up + dw - 1;
}
for (int k = j-1; k > j - l[i][j]; k--){
up = min(up, u[i][k]);
dw = min(dw, d[i][k]);
siz += up + dw - 1;
}
ans = max(ans, siz);
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
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 |
0 ms |
348 KB |
ok |
7 |
Correct |
2 ms |
604 KB |
ok |
8 |
Correct |
157 ms |
7396 KB |
ok |
9 |
Execution timed out |
4524 ms |
110416 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
0 ms |
348 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
0 ms |
420 KB |
ok |
9 |
Correct |
0 ms |
348 KB |
ok |
10 |
Correct |
0 ms |
348 KB |
ok |
11 |
Correct |
0 ms |
348 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Correct |
0 ms |
500 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
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 |
0 ms |
348 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Correct |
0 ms |
420 KB |
ok |
10 |
Correct |
0 ms |
348 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 |
0 ms |
500 KB |
ok |
15 |
Correct |
0 ms |
428 KB |
ok |
16 |
Partially correct |
0 ms |
348 KB |
partial |
17 |
Correct |
0 ms |
348 KB |
ok |
18 |
Correct |
0 ms |
348 KB |
ok |
19 |
Partially correct |
0 ms |
348 KB |
partial |
20 |
Correct |
0 ms |
348 KB |
ok |
21 |
Correct |
0 ms |
348 KB |
ok |
22 |
Partially correct |
0 ms |
348 KB |
partial |
23 |
Partially correct |
0 ms |
348 KB |
partial |
24 |
Partially correct |
0 ms |
348 KB |
partial |
25 |
Correct |
0 ms |
348 KB |
ok |
26 |
Correct |
0 ms |
348 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
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 |
0 ms |
348 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 |
348 KB |
ok |
11 |
Correct |
0 ms |
420 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Correct |
0 ms |
348 KB |
ok |
14 |
Correct |
0 ms |
348 KB |
ok |
15 |
Correct |
0 ms |
348 KB |
ok |
16 |
Correct |
0 ms |
500 KB |
ok |
17 |
Correct |
0 ms |
428 KB |
ok |
18 |
Partially correct |
0 ms |
348 KB |
partial |
19 |
Correct |
0 ms |
348 KB |
ok |
20 |
Correct |
0 ms |
348 KB |
ok |
21 |
Partially correct |
0 ms |
348 KB |
partial |
22 |
Correct |
0 ms |
348 KB |
ok |
23 |
Correct |
0 ms |
348 KB |
ok |
24 |
Partially correct |
0 ms |
348 KB |
partial |
25 |
Partially correct |
0 ms |
348 KB |
partial |
26 |
Partially correct |
0 ms |
348 KB |
partial |
27 |
Correct |
0 ms |
348 KB |
ok |
28 |
Correct |
0 ms |
348 KB |
ok |
29 |
Partially correct |
0 ms |
344 KB |
partial |
30 |
Correct |
0 ms |
344 KB |
ok |
31 |
Correct |
0 ms |
348 KB |
ok |
32 |
Correct |
0 ms |
348 KB |
ok |
33 |
Correct |
0 ms |
344 KB |
ok |
34 |
Incorrect |
0 ms |
344 KB |
wrong |
35 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
0 ms |
348 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 |
348 KB |
ok |
11 |
Correct |
0 ms |
420 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Correct |
0 ms |
348 KB |
ok |
14 |
Correct |
0 ms |
348 KB |
ok |
15 |
Correct |
0 ms |
348 KB |
ok |
16 |
Correct |
0 ms |
500 KB |
ok |
17 |
Correct |
0 ms |
428 KB |
ok |
18 |
Partially correct |
0 ms |
348 KB |
partial |
19 |
Correct |
0 ms |
348 KB |
ok |
20 |
Correct |
0 ms |
348 KB |
ok |
21 |
Partially correct |
0 ms |
348 KB |
partial |
22 |
Correct |
0 ms |
348 KB |
ok |
23 |
Correct |
0 ms |
348 KB |
ok |
24 |
Partially correct |
0 ms |
348 KB |
partial |
25 |
Partially correct |
0 ms |
348 KB |
partial |
26 |
Partially correct |
0 ms |
348 KB |
partial |
27 |
Correct |
0 ms |
348 KB |
ok |
28 |
Correct |
0 ms |
348 KB |
ok |
29 |
Partially correct |
0 ms |
344 KB |
partial |
30 |
Correct |
0 ms |
344 KB |
ok |
31 |
Correct |
0 ms |
348 KB |
ok |
32 |
Correct |
0 ms |
348 KB |
ok |
33 |
Correct |
0 ms |
344 KB |
ok |
34 |
Incorrect |
0 ms |
344 KB |
wrong |
35 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
2 ms |
604 KB |
ok |
9 |
Correct |
157 ms |
7396 KB |
ok |
10 |
Execution timed out |
4524 ms |
110416 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |