이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "soccer.h"
using namespace std;
int biggest_stadium(int N, std::vector<std::vector<int>> F)
{
bool f = true;
int c = 0;
vector<vector<int>> d(N, vector<int>(N));
if (1 == F[0][0]) {
d[0][0] = 2;
}
if (1 == F[0][N - 1]) {
d[0][N - 1] = 2;
}
if (1 == F[N - 1][0]) {
d[N - 1][0] = 2;
}
if (1 == F[N - 1][N - 1]) {
d[N - 1][N - 1] = 2;
}
for (int i = 0; i < N; i ++) {
for (int j = 0; j < N; j ++) {
if (0 < i) {
d[i][j] = max(d[i][j], d[i - 1][j]);
}
if (0 < j) {
d[i][j] = max(d[i][j - 1], d[i][j]);
}
if (i < N - 1) {
d[i][j] = max(d[i + 1][j], d[i][j]);
}
if (j < N - 1) {
d[i][j] = max(d[i][j + 1], d[i][j]);
}
}
for (int j = N - 1; 0 <= j; j --) {
if (0 < i) {
d[i][j] = max(d[i][j], d[i - 1][j]);
}
if (0 < j) {
d[i][j] = max(d[i][j - 1], d[i][j]);
}
if (i < N - 1) {
d[i][j] = max(d[i + 1][j], d[i][j]);
}
if (j < N - 1) {
d[i][j] = max(d[i][j + 1], d[i][j]);
}
}
}
for (int i = N - 1; 0 <= i; i --) {
for (int j = 0; j < N; j ++) {
if (0 < i) {
d[i][j] = max(d[i][j], d[i - 1][j]);
}
if (0 < j) {
d[i][j] = max(d[i][j - 1], d[i][j]);
}
if (i < N - 1) {
d[i][j] = max(d[i + 1][j], d[i][j]);
}
if (j < N - 1) {
d[i][j] = max(d[i][j + 1], d[i][j]);
}
}
for (int j = N - 1; 0 <= j; j --) {
if (0 < i) {
d[i][j] = max(d[i][j], d[i - 1][j]);
}
if (0 < j) {
d[i][j] = max(d[i][j - 1], d[i][j]);
}
if (i < N - 1) {
d[i][j] = max(d[i + 1][j], d[i][j]);
}
if (j < N - 1) {
d[i][j] = max(d[i][j + 1], d[i][j]);
}
}
}
for (int i = 0; i < N; i ++) {
for (int j = 0; j < N; j ++) {
if (F[i][j] == 1) {
if (0 == d[i][j]) {
f = false;
}
} else {
c ++;
}
}
}
if (f) {
return c;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |