#include "soccer.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 2004;
int u[N][N];
int d[N][N];
vector <int> get (vector <int> a) {
int n = (int)a.size();
vector <int> b(n);
for (int i = 0; i < n; i++) {
int mn = a[i], sum = 0;
for (int j = i; j >= 0; j--) {
mn = min(mn, a[j]);
sum += mn;
}
b[i] = sum;
}
return b;
}
int biggest_stadium(int N, std::vector<std::vector<int>> F) {
int mx = 0;
int n = N;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (F[i][j]) {
u[i][j] = 0;
} else if (i == 0) {
u[i][j] = 1;
} else {
u[i][j] = u[i - 1][j] + 1;
}
}
}
for (int i = n - 1; i >= 0; i--) {
for (int j = 0; j < n; j++) {
if (F[i][j]) {
d[i][j] = 0;
} else if (i == n - 1) {
d[i][j] = 1;
} else {
d[i][j] = d[i + 1][j] + 1;
}
}
}
for (int i = 0; i < n; i++) {
vector <int> A, B;
for (int j = 0; j < n; j++) {
A.push_back(d[i][j]);
B.push_back(max (0, u[i][j] - 1));
}
vector <int> a = get (A);
vector <int> b = get (B);
reverse (A.begin(), A.end());
reverse (B.begin(), B.end());
vector <int> c = get (A);
vector <int> e = get (B);
reverse (c.begin(), c.end());
reverse (e.begin(), e.end());
for (int j = 0; j < n; j++) {
if (F[i][j])
continue;
mx = max (mx, a[j] + b[j] + c[j] + e[j] - (d[i][j] + u[i][j] - 1));
}
}
return mx;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
1 ms |
348 KB |
ok |
5 |
Correct |
1 ms |
348 KB |
ok |
6 |
Correct |
1 ms |
348 KB |
ok |
7 |
Correct |
3 ms |
1368 KB |
ok |
8 |
Correct |
186 ms |
8796 KB |
ok |
9 |
Execution timed out |
4569 ms |
70996 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
1 ms |
344 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
1 ms |
344 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Incorrect |
0 ms |
348 KB |
wrong |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
1 ms |
344 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
1 ms |
344 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Incorrect |
0 ms |
348 KB |
wrong |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
1 ms |
348 KB |
ok |
6 |
Correct |
1 ms |
344 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
1 ms |
344 KB |
ok |
9 |
Correct |
0 ms |
348 KB |
ok |
10 |
Incorrect |
0 ms |
348 KB |
wrong |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
1 ms |
348 KB |
ok |
6 |
Correct |
1 ms |
344 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
1 ms |
344 KB |
ok |
9 |
Correct |
0 ms |
348 KB |
ok |
10 |
Incorrect |
0 ms |
348 KB |
wrong |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
1 ms |
348 KB |
ok |
6 |
Correct |
1 ms |
348 KB |
ok |
7 |
Correct |
1 ms |
348 KB |
ok |
8 |
Correct |
3 ms |
1368 KB |
ok |
9 |
Correct |
186 ms |
8796 KB |
ok |
10 |
Execution timed out |
4569 ms |
70996 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |