#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];
for (int i=0;i<n;i++)
for (int j=0;j<m;j++)
if (F[i][j]==0)
{
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-F.size();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
348 KB |
partial |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
420 KB |
wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
420 KB |
wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
348 KB |
partial |
2 |
Incorrect |
1 ms |
420 KB |
wrong |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
348 KB |
partial |
2 |
Incorrect |
1 ms |
420 KB |
wrong |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
348 KB |
partial |
2 |
Incorrect |
1 ms |
420 KB |
wrong |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
348 KB |
partial |
2 |
Incorrect |
1 ms |
420 KB |
wrong |
3 |
Halted |
0 ms |
0 KB |
- |