#include <bits/stdc++.h>
#include "soccer.h"
using namespace std;
int n, mx;
vector<vector<int>> a, v;
void f(int x) {
if (x == n * n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (!v[i][j]) continue;
vector<vector<bool>> vis(n, vector<bool>(n));
vis[i][j] = true;
for (int z = 0; z < 2; z++) {
for (int k = 0; k < n; k++) {
for (int l = 0; l < n; l++) {
if (!vis[k][l]) continue;
for (int m = l - 1; m >= 0 && v[k][m]; m--)
vis[k][m] = true;
for (int m = l + 1; m < n && v[k][m]; m++)
vis[k][m] = true;
for (int m = k - 1; m >= 0 && v[m][l]; m--)
vis[m][l] = true;
for (int m = k + 1; m < n && v[m][l]; m++)
vis[m][l] = true;
}
}
}
for (int k = 0; k < n; k++) {
for (int l = 0; l < n; l++)
if (v[k][l] && !vis[k][l]) return;
}
}
}
int cnt = 0;
for (auto i : v)
cnt += count(i.begin(), i.end(), 1);
mx = max(mx, cnt);
return;
}
for (int i = 0; i < 2; i++) {
if (i && a[x / n][x % n]) return;
v[x / n][x % n] = i;
f(x + 1);
}
}
int biggest_stadium(int N, vector<vector<int>> F) {
n = N; a = F;
int cnt = 0;
for (auto i : a)
cnt += count(i.begin(), i.end(), 1);
if (!cnt) return n * n;
else if (cnt == 1) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (a[i][j] == 1)
return n * n - min({(n - i) * (n - j), (n - i) * (j + 1), (i + 1) * (n - j), (i + 1) * (j + 1)});
}
}
}
v.assign(n, vector<int>(n));
f(0);
return mx;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
2937 ms |
412 KB |
partial |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
ok |
2 |
Correct |
0 ms |
420 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Correct |
1 ms |
476 KB |
ok |
8 |
Correct |
12 ms |
3420 KB |
ok |
9 |
Correct |
204 ms |
47400 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
ok |
2 |
Correct |
0 ms |
420 KB |
ok |
3 |
Correct |
1 ms |
344 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Incorrect |
0 ms |
348 KB |
wrong |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
2937 ms |
412 KB |
partial |
2 |
Correct |
1 ms |
344 KB |
ok |
3 |
Correct |
0 ms |
420 KB |
ok |
4 |
Correct |
1 ms |
344 KB |
ok |
5 |
Correct |
0 ms |
348 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 |
Partially correct |
2937 ms |
412 KB |
partial |
2 |
Correct |
1 ms |
344 KB |
ok |
3 |
Correct |
0 ms |
420 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
1 ms |
344 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Incorrect |
0 ms |
348 KB |
wrong |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
2937 ms |
412 KB |
partial |
2 |
Correct |
1 ms |
344 KB |
ok |
3 |
Correct |
0 ms |
420 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
1 ms |
344 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Incorrect |
0 ms |
348 KB |
wrong |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
2937 ms |
412 KB |
partial |
2 |
Correct |
1 ms |
344 KB |
ok |
3 |
Correct |
0 ms |
420 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
1 ms |
476 KB |
ok |
9 |
Correct |
12 ms |
3420 KB |
ok |
10 |
Correct |
204 ms |
47400 KB |
ok |
11 |
Correct |
1 ms |
344 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Correct |
0 ms |
348 KB |
ok |
14 |
Incorrect |
0 ms |
348 KB |
wrong |
15 |
Halted |
0 ms |
0 KB |
- |