#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++) {
vector<vector<bool>> vis2(n, vector<bool>(n));
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--)
vis2[k][m] = true;
for (int m = l + 1; m < n && v[k][m]; m++)
vis2[k][m] = true;
for (int m = k - 1; m >= 0 && v[m][l]; m--)
vis2[m][l] = true;
for (int m = k + 1; m < n && v[m][l]; m++)
vis2[m][l] = true;
}
}
for (int k = 0; k < n; k++) {
for (int l = 0; l < n; l++)
if (vis2[k][l]) vis[k][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)});
}
}
}
if (n < 4) {
v.assign(n, vector<int>(n));
f(0);
return mx;
}
cnt = 0;
for (auto i : a)
cnt += count(i.begin(), i.end(), 0);
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (a[i][j]) continue;
vector<vector<bool>> vis(n, vector<bool>(n));
vis[i][j] = true;
for (int z = 0; z < 2; z++) {
vector<vector<bool>> vis2(n, vector<bool>(n));
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 && !a[k][m]; m--)
vis2[k][m] = true;
for (int m = l + 1; m < n && !a[k][m]; m++)
vis2[k][m] = true;
for (int m = k - 1; m >= 0 && !a[m][l]; m--)
vis2[m][l] = true;
for (int m = k + 1; m < n && !a[m][l]; m++)
vis2[m][l] = true;
}
}
for (int k = 0; k < n; k++) {
for (int l = 0; l < n; l++)
if (vis2[k][l]) vis[k][l] = true;
}
}
for (int k = 0; k < n; k++) {
for (int l = 0; l < n; l++)
if (!a[k][l] && !vis[k][l]) return 0;
}
}
}
return cnt;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
0 ms |
348 KB |
partial |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
1 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
1 ms |
348 KB |
ok |
7 |
Correct |
1 ms |
348 KB |
ok |
8 |
Correct |
13 ms |
3228 KB |
ok |
9 |
Correct |
206 ms |
47444 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 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 |
0 ms |
348 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Correct |
0 ms |
348 KB |
ok |
10 |
Correct |
0 ms |
348 KB |
ok |
11 |
Correct |
0 ms |
348 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Correct |
1 ms |
348 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
0 ms |
348 KB |
partial |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 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 |
0 ms |
348 KB |
ok |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Correct |
0 ms |
348 KB |
ok |
10 |
Correct |
0 ms |
348 KB |
ok |
11 |
Correct |
0 ms |
348 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Correct |
0 ms |
348 KB |
ok |
14 |
Correct |
1 ms |
348 KB |
ok |
15 |
Partially correct |
1 ms |
344 KB |
partial |
16 |
Partially correct |
1 ms |
348 KB |
partial |
17 |
Partially correct |
0 ms |
348 KB |
partial |
18 |
Partially correct |
0 ms |
344 KB |
partial |
19 |
Partially correct |
0 ms |
348 KB |
partial |
20 |
Correct |
0 ms |
348 KB |
ok |
21 |
Correct |
1 ms |
348 KB |
ok |
22 |
Partially correct |
1 ms |
344 KB |
partial |
23 |
Partially correct |
0 ms |
348 KB |
partial |
24 |
Partially correct |
1 ms |
348 KB |
partial |
25 |
Partially correct |
0 ms |
348 KB |
partial |
26 |
Partially correct |
0 ms |
348 KB |
partial |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
0 ms |
348 KB |
partial |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
1 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 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 |
0 ms |
348 KB |
ok |
10 |
Correct |
0 ms |
348 KB |
ok |
11 |
Correct |
0 ms |
348 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Correct |
0 ms |
348 KB |
ok |
14 |
Correct |
0 ms |
348 KB |
ok |
15 |
Correct |
0 ms |
348 KB |
ok |
16 |
Correct |
1 ms |
348 KB |
ok |
17 |
Partially correct |
1 ms |
344 KB |
partial |
18 |
Partially correct |
1 ms |
348 KB |
partial |
19 |
Partially correct |
0 ms |
348 KB |
partial |
20 |
Partially correct |
0 ms |
344 KB |
partial |
21 |
Partially correct |
0 ms |
348 KB |
partial |
22 |
Correct |
0 ms |
348 KB |
ok |
23 |
Correct |
1 ms |
348 KB |
ok |
24 |
Partially correct |
1 ms |
344 KB |
partial |
25 |
Partially correct |
0 ms |
348 KB |
partial |
26 |
Partially correct |
1 ms |
348 KB |
partial |
27 |
Partially correct |
0 ms |
348 KB |
partial |
28 |
Partially correct |
0 ms |
348 KB |
partial |
29 |
Partially correct |
1 ms |
348 KB |
partial |
30 |
Partially correct |
0 ms |
348 KB |
partial |
31 |
Partially correct |
0 ms |
348 KB |
partial |
32 |
Partially correct |
0 ms |
348 KB |
partial |
33 |
Partially correct |
0 ms |
436 KB |
partial |
34 |
Correct |
2 ms |
348 KB |
ok |
35 |
Correct |
4 ms |
440 KB |
ok |
36 |
Partially correct |
2 ms |
348 KB |
partial |
37 |
Partially correct |
1 ms |
348 KB |
partial |
38 |
Partially correct |
0 ms |
348 KB |
partial |
39 |
Partially correct |
0 ms |
348 KB |
partial |
40 |
Partially correct |
0 ms |
348 KB |
partial |
41 |
Partially correct |
0 ms |
348 KB |
partial |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
0 ms |
348 KB |
partial |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
1 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 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 |
0 ms |
348 KB |
ok |
10 |
Correct |
0 ms |
348 KB |
ok |
11 |
Correct |
0 ms |
348 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Correct |
0 ms |
348 KB |
ok |
14 |
Correct |
0 ms |
348 KB |
ok |
15 |
Correct |
0 ms |
348 KB |
ok |
16 |
Correct |
1 ms |
348 KB |
ok |
17 |
Partially correct |
1 ms |
344 KB |
partial |
18 |
Partially correct |
1 ms |
348 KB |
partial |
19 |
Partially correct |
0 ms |
348 KB |
partial |
20 |
Partially correct |
0 ms |
344 KB |
partial |
21 |
Partially correct |
0 ms |
348 KB |
partial |
22 |
Correct |
0 ms |
348 KB |
ok |
23 |
Correct |
1 ms |
348 KB |
ok |
24 |
Partially correct |
1 ms |
344 KB |
partial |
25 |
Partially correct |
0 ms |
348 KB |
partial |
26 |
Partially correct |
1 ms |
348 KB |
partial |
27 |
Partially correct |
0 ms |
348 KB |
partial |
28 |
Partially correct |
0 ms |
348 KB |
partial |
29 |
Partially correct |
1 ms |
348 KB |
partial |
30 |
Partially correct |
0 ms |
348 KB |
partial |
31 |
Partially correct |
0 ms |
348 KB |
partial |
32 |
Partially correct |
0 ms |
348 KB |
partial |
33 |
Partially correct |
0 ms |
436 KB |
partial |
34 |
Correct |
2 ms |
348 KB |
ok |
35 |
Correct |
4 ms |
440 KB |
ok |
36 |
Partially correct |
2 ms |
348 KB |
partial |
37 |
Partially correct |
1 ms |
348 KB |
partial |
38 |
Partially correct |
0 ms |
348 KB |
partial |
39 |
Partially correct |
0 ms |
348 KB |
partial |
40 |
Partially correct |
0 ms |
348 KB |
partial |
41 |
Partially correct |
0 ms |
348 KB |
partial |
42 |
Partially correct |
15 ms |
3932 KB |
partial |
43 |
Partially correct |
17 ms |
3924 KB |
partial |
44 |
Partially correct |
15 ms |
3932 KB |
partial |
45 |
Partially correct |
20 ms |
4032 KB |
partial |
46 |
Partially correct |
14 ms |
3764 KB |
partial |
47 |
Partially correct |
16 ms |
3932 KB |
partial |
48 |
Execution timed out |
4576 ms |
3932 KB |
Time limit exceeded |
49 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
0 ms |
348 KB |
partial |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
1 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Correct |
1 ms |
348 KB |
ok |
8 |
Correct |
1 ms |
348 KB |
ok |
9 |
Correct |
13 ms |
3228 KB |
ok |
10 |
Correct |
206 ms |
47444 KB |
ok |
11 |
Correct |
0 ms |
344 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Correct |
0 ms |
348 KB |
ok |
14 |
Correct |
0 ms |
348 KB |
ok |
15 |
Correct |
0 ms |
348 KB |
ok |
16 |
Correct |
0 ms |
348 KB |
ok |
17 |
Correct |
0 ms |
348 KB |
ok |
18 |
Correct |
0 ms |
348 KB |
ok |
19 |
Correct |
0 ms |
348 KB |
ok |
20 |
Correct |
0 ms |
348 KB |
ok |
21 |
Correct |
1 ms |
348 KB |
ok |
22 |
Partially correct |
1 ms |
344 KB |
partial |
23 |
Partially correct |
1 ms |
348 KB |
partial |
24 |
Partially correct |
0 ms |
348 KB |
partial |
25 |
Partially correct |
0 ms |
344 KB |
partial |
26 |
Partially correct |
0 ms |
348 KB |
partial |
27 |
Correct |
0 ms |
348 KB |
ok |
28 |
Correct |
1 ms |
348 KB |
ok |
29 |
Partially correct |
1 ms |
344 KB |
partial |
30 |
Partially correct |
0 ms |
348 KB |
partial |
31 |
Partially correct |
1 ms |
348 KB |
partial |
32 |
Partially correct |
0 ms |
348 KB |
partial |
33 |
Partially correct |
0 ms |
348 KB |
partial |
34 |
Partially correct |
1 ms |
348 KB |
partial |
35 |
Partially correct |
0 ms |
348 KB |
partial |
36 |
Partially correct |
0 ms |
348 KB |
partial |
37 |
Partially correct |
0 ms |
348 KB |
partial |
38 |
Partially correct |
0 ms |
436 KB |
partial |
39 |
Correct |
2 ms |
348 KB |
ok |
40 |
Correct |
4 ms |
440 KB |
ok |
41 |
Partially correct |
2 ms |
348 KB |
partial |
42 |
Partially correct |
1 ms |
348 KB |
partial |
43 |
Partially correct |
0 ms |
348 KB |
partial |
44 |
Partially correct |
0 ms |
348 KB |
partial |
45 |
Partially correct |
0 ms |
348 KB |
partial |
46 |
Partially correct |
0 ms |
348 KB |
partial |
47 |
Partially correct |
15 ms |
3932 KB |
partial |
48 |
Partially correct |
17 ms |
3924 KB |
partial |
49 |
Partially correct |
15 ms |
3932 KB |
partial |
50 |
Partially correct |
20 ms |
4032 KB |
partial |
51 |
Partially correct |
14 ms |
3764 KB |
partial |
52 |
Partially correct |
16 ms |
3932 KB |
partial |
53 |
Execution timed out |
4576 ms |
3932 KB |
Time limit exceeded |
54 |
Halted |
0 ms |
0 KB |
- |