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 <vector>
using namespace std;
int biggest_stadium(int N, vector<vector<int>> F)
{
int n=F.size(),m=F[0].size();
for (int i=0;i<n;i++)
for (int j=0;j<m;j++)
F[i][j]^=1;
int pre[n+1][m+1]={};
for (int i=0;i<n;i++)
for (int j=0;j<m;j++)
pre[i+1][j+1]=pre[i+1][j]+pre[i][j+1]+F[i][j];
int cnt=0;
for (int i=0;i<n;i++)
for (int j=0;j<m;j++)
if (F[i][j]==0)
{
cnt++;
int a=i+1,b=1,c=i+1,d=j+1;
if (pre[c][d]-pre[a-1][d]-pre[c][b-1]+pre[a-1][b-1]>0)
{
a=c,b=d;
c=i+1,d=m;
if (pre[c][d]-pre[a-1][d]-pre[c][b-1]+pre[a-1][b-1]>0)
return 69;
}
a=1,b=j+1,c=i+1,d=j+1;
if (pre[c][d]-pre[a-1][d]-pre[c][b-1]+pre[a-1][b-1]>0)
{
a=c,b=d;
c=n,d=j+1;
if (pre[c][d]-pre[a-1][d]-pre[c][b-1]+pre[a-1][b-1]>0)
return 69;
}
}
return N*N-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... |