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 "soccer.h"
#include <iostream>
#include <algorithm>
#define pii pair<int, int>
#define ff first
#define ss second
using namespace std;
const int INF = (int)1e9 + 7;
int biggest_stadium(int N, vector<vector<int>> F)
{
int L[N][N], R[N][N];
for(int i = 0; i < N; ++i)
{
for(int j = 0; j < N; ++j)
{
if(F[i][j]) L[i][j] = j;
else L[i][j] = (j ? L[i][j - 1] : -1);
}
for(int j = N - 1; j >= 0; --j)
{
if(F[i][j]) R[i][j] = j;
else R[i][j] = (j < N - 1 ? R[i][j + 1] : N);
}
}
int ret = 0;
for(int i = 0; i < N; ++i)
{
for(int j = 0; j < N; ++j) if(!F[i][j])
{
int ans = R[i][j] - L[i][j] - 1;
int l = L[i][j], r = R[i][j];
for(int k = i + 1; k < N && !F[k][j]; ++k)
{
l = max(l, L[k][j]);
r = min(r, R[k][j]);
ans += r - l - 1;
}
l = L[i][j], r = R[i][j];
for(int k = i - 1; k >= 0 && !F[k][j]; --k)
{
l = max(l, L[k][j]);
r = min(r, R[k][j]);
ans += r - l - 1;
}
ret = max(ret, ans);
}
}
return ret;
}
# | 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... |