#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 |
1 |
Correct |
0 ms |
344 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
ok |
2 |
Correct |
0 ms |
344 KB |
ok |
3 |
Correct |
0 ms |
344 KB |
ok |
4 |
Correct |
0 ms |
344 KB |
ok |
5 |
Correct |
0 ms |
344 KB |
ok |
6 |
Correct |
0 ms |
344 KB |
ok |
7 |
Correct |
3 ms |
348 KB |
ok |
8 |
Correct |
298 ms |
4188 KB |
ok |
9 |
Execution timed out |
4519 ms |
63056 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
ok |
2 |
Correct |
0 ms |
344 KB |
ok |
3 |
Correct |
0 ms |
344 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
1 ms |
344 KB |
ok |
7 |
Incorrect |
1 ms |
344 KB |
wrong |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
ok |
2 |
Correct |
0 ms |
344 KB |
ok |
3 |
Correct |
0 ms |
344 KB |
ok |
4 |
Correct |
0 ms |
344 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Correct |
1 ms |
344 KB |
ok |
8 |
Incorrect |
1 ms |
344 KB |
wrong |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
ok |
2 |
Correct |
0 ms |
344 KB |
ok |
3 |
Correct |
0 ms |
344 KB |
ok |
4 |
Correct |
0 ms |
344 KB |
ok |
5 |
Correct |
0 ms |
344 KB |
ok |
6 |
Correct |
0 ms |
344 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Correct |
1 ms |
344 KB |
ok |
10 |
Incorrect |
1 ms |
344 KB |
wrong |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
ok |
2 |
Correct |
0 ms |
344 KB |
ok |
3 |
Correct |
0 ms |
344 KB |
ok |
4 |
Correct |
0 ms |
344 KB |
ok |
5 |
Correct |
0 ms |
344 KB |
ok |
6 |
Correct |
0 ms |
344 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Correct |
1 ms |
344 KB |
ok |
10 |
Incorrect |
1 ms |
344 KB |
wrong |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
ok |
2 |
Correct |
0 ms |
344 KB |
ok |
3 |
Correct |
0 ms |
344 KB |
ok |
4 |
Correct |
0 ms |
344 KB |
ok |
5 |
Correct |
0 ms |
344 KB |
ok |
6 |
Correct |
0 ms |
344 KB |
ok |
7 |
Correct |
0 ms |
344 KB |
ok |
8 |
Correct |
3 ms |
348 KB |
ok |
9 |
Correct |
298 ms |
4188 KB |
ok |
10 |
Execution timed out |
4519 ms |
63056 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |