이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "soccer.h"
using namespace std;
const int nmax = 2e3;
int n;
int a[nmax + 5][nmax + 5];
int st[nmax + 5], dr[nmax + 5];
bool verif()
{
for(int i=1; i<=n; i++)
{
st[i] = dr[i] = 0;
}
for(int i=1; i<=n; i++)
{
for(int j=1; j<=n; j++)
{
if(a[i][j]==0 && a[i][j - 1]==1)
{
if(st[i])
{
return false;
}
st[i] = j;
}
if(a[i][j]==0)
{
dr[i] = j;
}
}
}
bool desc_st = false, desc_dr = false, start = false;
for(int i=2; i<=n; i++)
{
if(st[i] && !st[i-1] && start)
{
return false;
}
if(st[i])
{
start = true;
if(st[i - 1] && st[i] < st[i - 1] && desc_st)
{
return false;
}
if(st[i - 1] && st[i] > st[i - 1])
{
desc_st = true;
}
if(dr[i - 1] && dr[i] > dr[i - 1] && desc_dr)
{
return false;
}
if(dr[i - 1] && dr[i] < dr[i - 1])
{
desc_dr = true;
}
}
}
return true;
}
int biggest_stadium(int N, std::vector<std::vector<int>> F)
{
n = N;
int nre = 0;
for(int i=1; i<=n; i++)
{
for(int j=1; j<=n; j++)
{
a[i][j] = F[i - 1][j - 1];
nre += (1 - a[i][j]);
}
}
for(int i=0; i<=n; i++)
{
a[i][0] = a[0][i] = a[i][n + 1] = a[n + 1][i] = 1;
}
bool ok = verif();
if(ok)
{
return nre;
}
return nre - 1;
}
# | 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... |