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 "bits/stdc++.h"
#include "soccer.h"
#define FOR(i, begin, end) for(int i=(begin); i<(end); i++)
#define pb push_back
using namespace std;
typedef vector<int> vi;
const int N=2e3+10;
int n, f[N][N], par[N][N];
bool ai[N][N], bi[N][N], aj[N][N], bj[N][N];
int biggest_stadium(int N, std::vector<std::vector<int>> F) {
n=N; FOR(i, 0, n) FOR(j, 0, n) f[i][j]=F[i][j];
FOR(i, 0, n) {
FOR(j, 0, n) {
if(j==0) {
if(f[i][j]) aj[i][j]=true;
continue;
}
aj[i][j]=aj[i][j-1]&f[i][j];
}
for(int j=n-1; j>=0; j--) {
if(j==n-1) {
if(f[i][j]) bj[i][j]=true;
continue;
}
bj[i][j]=bj[i][j+1]&f[i][j];
}
}
FOR(j, 0, n) {
FOR(i, 0, n) {
if(i==0) {
if(f[i][j]) ai[i][j]=true;
continue;
}
ai[i][j]=ai[i-1][j]&f[i][j];
}
for(int i=n-1; i>=0; i--) {
if(i==n-1) {
if(f[i][j]) bi[i][j]=true;
continue;
}
bi[i][j]=bi[i+1][j]&f[i][j];
}
}
int cn=0;
FOR(i, 0, n) {
FOR(j, 0, n) {
if(f[i][j]) {
bool ok=false;
ok|=ai[i][j]&aj[i][j];
ok|=bi[i][j]&aj[i][j];
ok|=ai[i][j]&bj[i][j];
ok|=bi[i][j]&bj[i][j];
if(!ok) return 0;
}
else cn++;
}
}
return cn;
}
/*
5
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
1 1 0 0 0
0 0
0 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... |