#include "soccer.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 2004;
int u[N][N];
int d[N][N];
vector <int> get (vector <int> a) {
int n = (int)a.size();
vector <int> b(n);
for (int i = 0; i < n; i++) {
int mn = a[i], sum = 0;
for (int j = i; j >= 0; j--) {
mn = min(mn, a[j]);
sum += mn;
}
b[i] = sum;
}
return b;
}
int biggest_stadium(int N, std::vector<std::vector<int>> F) {
int mx = 0;
int n = N;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (F[i][j]) {
int mx = min ({(i + 1) * (j + 1), (i + 1) * (n - j), (n - i) * (j + 1), (n - i) * (n - j)});
return n * n - mx;
}
if (F[i][j]) {
u[i][j] = 0;
} else if (i == 0) {
u[i][j] = 1;
} else {
u[i][j] = u[i - 1][j] + 1;
}
}
}
for (int i = n - 1; i >= 0; i--) {
for (int j = 0; j < n; j++) {
if (F[i][j]) {
d[i][j] = 0;
} else if (i == n - 1) {
d[i][j] = 1;
} else {
d[i][j] = d[i + 1][j] + 1;
}
}
}
for (int i = 0; i < n; i++) {
vector <int> A, B;
for (int j = 0; j < n; j++) {
A.push_back(d[i][j]);
B.push_back(max (0, u[i][j] - 1));
}
vector <int> a = get (A);
vector <int> b = get (B);
reverse (A.begin(), A.end());
reverse (B.begin(), B.end());
vector <int> c = get (A);
vector <int> e = get (B);
reverse (c.begin(), c.end());
reverse (e.begin(), e.end());
for (int j = 0; j < n; j++) {
if (F[i][j])
continue;
mx = max (mx, a[j] + b[j] + c[j] + e[j] - (d[i][j] + u[i][j] - 1));
}
}
return mx;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
wrong |
2 |
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 |
1 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
1 ms |
344 KB |
ok |
7 |
Correct |
1 ms |
600 KB |
ok |
8 |
Correct |
14 ms |
4952 KB |
ok |
9 |
Correct |
213 ms |
45356 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
344 KB |
ok |
4 |
Correct |
0 ms |
344 KB |
ok |
5 |
Partially correct |
0 ms |
348 KB |
partial |
6 |
Partially correct |
0 ms |
348 KB |
partial |
7 |
Partially correct |
0 ms |
348 KB |
partial |
8 |
Incorrect |
0 ms |
348 KB |
wrong |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
wrong |
2 |
Halted |
0 ms |
0 KB |
- |