#include "soccer.h"
#include <bits/stdc++.h>
#define maxn 2005
using namespace std;
int n, f[maxn][maxn], s[maxn][maxn];
int biggest_stadium(int N, vector<vector<int>> F) {
n = N;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
f[i][j] = F[i-1][j-1];
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
s[i][j] = s[i-1][j] + s[i][j-1] - s[i-1][j-1] + 1 - f[i][j];
function<int(int, int, int, int)> getRect = [&](int u, int v, int x, int y) {
return s[x][y] - s[u-1][y] - s[x][v-1] + s[u-1][v-1];
};
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
if (f[i][j]) {
if (getRect(1, j, i, j) && getRect(i, j, n, j)) return 0;
if (getRect(i, 1, i, j) && getRect(i, j, i, n)) return 0;
}
return s[n][n];
}
# | 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... |