# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1078289 | PanosPask | Soccer Stadium (IOI23_soccer) | C++17 | 1 ms | 348 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "soccer.h"
using namespace std;
vector<vector<int>> grid;
vector<bool> empty_row;
vector<vector<int>> rotated;
vector<bool> empty_column;
bool check_row(vector<int>& r, vector<bool>& place, int pos)
{
bool started = false;
bool ended = false;
for (int i = 0; i < r.size(); i++) {
if (r[i] == 0) {
if (ended) {
return false;
}
if (!started) {
started = true;
}
}
else {
if (started) {
ended = true;
}
}
}
place[pos] = started;
return true;
}
int biggest_stadium(int N, std::vector<std::vector<int>> F)
{
grid.resize(N, vector<int>(N));
rotated.resize(N, vector<int>(N));
empty_column.resize(N);
empty_row.resize(N);
int tot = 0;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
grid[i][j] = F[i][j];
rotated[j][i] = F[i][j];
tot += !F[i][j];
}
}
bool good = true;
for (int i = 0; i < N; i++) {
good = good && check_row(grid[i], empty_row, i) && check_row(rotated[i], empty_column, i);
}
if (!good) {
return 0;
}
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
if (empty_row[i] && empty_column[j]) {
if (F[i][j] && F[j][i]) {
return 0;
}
}
}
}
return tot;
}
Compilation message (stderr)
# | 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... |