이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/* Ignut
started: 13.08.2024
now: 13.08.2024
████████████████████████████████████████████████████████████████████
████████████████████████████████ ████████████████████████████████
██████████████████████████████ ██████████████████████████████
██████ ██████████████████ ██████████████████ ██████
██████ ██████████████ ██████████████ ██████
██████ ██ ████████████ ████████████ ██ ██████
██████ ████ ██████████ ██████████ ████ ██████
██████ ████ ██████████ ██████████ ████ ██████
██████ ████ ██████████ ██████████ ██████ ██████
██████ ██████ ██████████ ██████████ ██████ ██████
██████ ██████ ████████ ████████ ██████ ██████
██████ ██████ ██████ ██████ ██████ ██████
██████ ████ ████ ████ ████ ██████
██████ ██████████ ████ ██████████ ██████
██████ ██ ██████ ████████ ██████ ██ ██████
██████ ██████ ████████ ██████ ██████
██████ ██ ██ ██████
██████████████████████ ████ ████ ██████████████████████
████████████████████████ ██ ██ ████████████████████████
██████████████████████████ ██████████████████████████
██████████████████████████████ ██████████████████████████████
████████████████████████████████████████████████████████████████████
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MAXN = 2222;
int n;
vector<vector<int>> f;
bool used[MAXN][MAXN];
vector<pair<int, int>> delta = {{0, -1}, {0, 1}, {-1, 0}, {1, 0}};
bool Good(int i, int j) {
return i >= 0 && j >= 0 && i < n && j < n && f[i][j] == 0 && !used[i][j];
}
int cnt = 0;
void dfs(int i, int j) {
cnt ++;
used[i][j] = true;
for (auto [di, dj] : delta) {
int ci = i + di, cj = j + dj;
if (Good(ci, cj)) {
dfs(ci, cj);
}
}
}
int biggest_stadium(int N, vector<vector<int>> F) {
for (int i = 0; i < N; i ++) {
for (int j = 0; j < N; j ++) {
if (F[i][j] == 0) continue;
int mn = N * N;
mn = min(mn, (i + 1) * (j + 1));
mn = min(mn, (N - i) * (N - j));
mn = min(mn, (N - i) * (j + 1));
mn = min(mn, (i + 1) * (N - j));
return N * N - mn;
}
}
return N * N;
n = N;
f = F;
for (int i = 0; i < N; i ++) {
for (int j = 0; j < N; j ++) {
if (F[i][j] == 1) continue;
bool haveT = false;
for (int e = i; e < N; e ++) {
haveT |= F[e][j];
if (F[e][j] == 0 && haveT) {
return 0;
}
}
haveT = false;
for (int e = j; e < N; e ++) {
haveT |= F[i][e];
if (F[i][e] == 0 && haveT) {
return 0;
}
}
}
}
vector<pair<int, int>> vec;
for (int i = 0; i < N; i ++)
for (int j = 0; j < N; j ++)
if (F[i][j] == 0)
vec.push_back({i, j});
int sum = N * N;
for (int i = 0; i < N; i ++)
for (int j = 0; j < N; j ++)
sum -= F[i][j];
dfs(vec[0].first, vec[0].second);
if (cnt != sum) return 0;
return sum;
}
# | 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... |