이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include <debug.h>
#else
#define debug(...) 42
#endif
using ll = long long;
#define all(v) v.begin(), v.end()
#define len(v) int(v.size())
const ll INF = 1e18;
int biggest_stadium(int N, vector<vector<int>> F) {
vector<int> row_first(N, -1), row_last(N, -1), col_first(N, -1), col_last(N, -1);
int cnt = 0;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
if (!F[i][j]) {
cnt++;
if (row_last[i] != -1 && row_last[i] != j - 1) {
return 0;
}
row_last[i] = j;
if (row_first[i] == -1) row_first[i] = j;
}
}
}
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
if (!F[j][i]) {
if (col_last[i] != -1 && col_last[i] != j - 1) {
return 0;
}
col_last[i] = j;
if (col_first[i] == -1) col_first[i] = j;
}
}
}
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
if (!F[i][j]) {
if (row_first[i] != 0) {
if (col_first[j] != 0) {
if (!F[col_first[j] - 1][row_first[i] - 1]) {
return 0;
}
}
if (col_last[j] != N - 1) {
if (!F[col_last[j] + 1][row_first[i] - 1]) {
return 0;
}
}
}
if (row_last[i] != N - 1) {
if (col_first[j] != 0) {
if (!F[col_first[j] - 1][row_last[i] + 1]) {
return 0;
}
}
if (col_last[j] != N - 1) {
if (!F[col_last[j] + 1][row_last[i] + 1]) {
return 0;
}
}
}
}
}
}
return cnt;
}
| # | 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... |