#include "soccer.h"
int GoTo(std::vector<std::vector<bool>>& V, std::vector<std::vector<int>>& F, int i, int j, int dx1, int dx2, int dy1, int dy2, int N)
{
int count = 0;
int x1 = i, y1 = j;
while (true)
{
x1 += dx1;
y1 += dy1;
if (x1 < 0 || x1 >= N)
break;
if (y1 < 0 || y1 >= N)
break;
if (F[x1][y1] == 1)
{
break;
}
if (!V[x1][y1])
{
V[x1][y1] = true;
count++;
}
int x2 = x1;
int y2 = y1;
while (true)
{
x2 += dx2;
y2 += dy2;
if (x2 < 0 || x2 >= N)
break;
if (y2 < 0 || y2 >= N)
break;
if (F[x2][y2] == 1)
{
break;
}
if (!V[x2][y2])
{
V[x2][y2] = true;
count++;
}
}
}
return count;
}
int biggest_stadium(int N, std::vector<std::vector<int>> F)
{
int x, y;
int c = 0;
for (int i = 0; i < N; i++)
{
for (int j = 0; j < N; j++)
{
if (F[i][j] == 1)
{
c++;
x = i;
y = j;
}
}
}
if (c == 1)
{
return std::max(std::max(N * N - (x + 1) * (y + 1), N * N - (N - x) * (y + 1)), std::max(N * N - (x + 1) * (N - y), N * N - (N - x) * (N - y)));
}
c = N * N - c;
std::vector<std::vector<int>> S(N, std::vector<int>(N));
bool allmax = true;
if (N <= 30)
{
for (int i = 0; i < N; i++)
{
for (int j = 0; j < N; j++)
{
if (F[i][j] == 0)
{
std::vector<std::vector<bool>> V(N, std::vector<bool>(N));
int count = 1;
count += GoTo(V, F, i, j, 1, 0, 0, 1, N);
count += GoTo(V, F, i, j, 1, 0, 0, -1, N);
count += GoTo(V, F, i, j, -1, 0, 0, 1, N);
count += GoTo(V, F, i, j, -1, 0, 0, -1, N);
count += GoTo(V, F, i, j, 0, 1, 1, 0, N);
count += GoTo(V, F, i, j, 0, 1, -1, 0, N);
count += GoTo(V, F, i, j, 0, -1, 1, 0, N);
count += GoTo(V, F, i, j, 0, -1, -1, 0, N);
S[i][j] = count;
if (count != c)
{
allmax = false;
}
}
}
}
}
return allmax ? c : 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
212 KB |
partial |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
ok |
2 |
Correct |
0 ms |
212 KB |
ok |
3 |
Correct |
0 ms |
212 KB |
ok |
4 |
Correct |
1 ms |
212 KB |
ok |
5 |
Correct |
0 ms |
212 KB |
ok |
6 |
Correct |
0 ms |
212 KB |
ok |
7 |
Correct |
1 ms |
340 KB |
ok |
8 |
Correct |
15 ms |
2176 KB |
ok |
9 |
Correct |
242 ms |
31656 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
ok |
2 |
Correct |
0 ms |
212 KB |
ok |
3 |
Partially correct |
0 ms |
212 KB |
partial |
4 |
Partially correct |
1 ms |
212 KB |
partial |
5 |
Partially correct |
0 ms |
212 KB |
partial |
6 |
Partially correct |
0 ms |
212 KB |
partial |
7 |
Partially correct |
0 ms |
212 KB |
partial |
8 |
Correct |
0 ms |
212 KB |
ok |
9 |
Correct |
0 ms |
212 KB |
ok |
10 |
Partially correct |
0 ms |
212 KB |
partial |
11 |
Partially correct |
0 ms |
212 KB |
partial |
12 |
Partially correct |
0 ms |
212 KB |
partial |
13 |
Correct |
0 ms |
212 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
212 KB |
partial |
2 |
Correct |
0 ms |
212 KB |
ok |
3 |
Correct |
0 ms |
212 KB |
ok |
4 |
Partially correct |
0 ms |
212 KB |
partial |
5 |
Partially correct |
1 ms |
212 KB |
partial |
6 |
Partially correct |
0 ms |
212 KB |
partial |
7 |
Partially correct |
0 ms |
212 KB |
partial |
8 |
Partially correct |
0 ms |
212 KB |
partial |
9 |
Correct |
0 ms |
212 KB |
ok |
10 |
Correct |
0 ms |
212 KB |
ok |
11 |
Partially correct |
0 ms |
212 KB |
partial |
12 |
Partially correct |
0 ms |
212 KB |
partial |
13 |
Partially correct |
0 ms |
212 KB |
partial |
14 |
Correct |
0 ms |
212 KB |
ok |
15 |
Partially correct |
0 ms |
212 KB |
partial |
16 |
Partially correct |
0 ms |
212 KB |
partial |
17 |
Partially correct |
0 ms |
212 KB |
partial |
18 |
Partially correct |
0 ms |
212 KB |
partial |
19 |
Partially correct |
0 ms |
212 KB |
partial |
20 |
Correct |
1 ms |
212 KB |
ok |
21 |
Correct |
0 ms |
212 KB |
ok |
22 |
Partially correct |
0 ms |
212 KB |
partial |
23 |
Partially correct |
0 ms |
212 KB |
partial |
24 |
Partially correct |
0 ms |
212 KB |
partial |
25 |
Partially correct |
0 ms |
212 KB |
partial |
26 |
Partially correct |
0 ms |
212 KB |
partial |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
212 KB |
partial |
2 |
Correct |
0 ms |
212 KB |
ok |
3 |
Correct |
0 ms |
212 KB |
ok |
4 |
Correct |
0 ms |
212 KB |
ok |
5 |
Correct |
1 ms |
212 KB |
ok |
6 |
Partially correct |
0 ms |
212 KB |
partial |
7 |
Partially correct |
1 ms |
212 KB |
partial |
8 |
Partially correct |
0 ms |
212 KB |
partial |
9 |
Partially correct |
0 ms |
212 KB |
partial |
10 |
Partially correct |
0 ms |
212 KB |
partial |
11 |
Correct |
0 ms |
212 KB |
ok |
12 |
Correct |
0 ms |
212 KB |
ok |
13 |
Partially correct |
0 ms |
212 KB |
partial |
14 |
Partially correct |
0 ms |
212 KB |
partial |
15 |
Partially correct |
0 ms |
212 KB |
partial |
16 |
Correct |
0 ms |
212 KB |
ok |
17 |
Partially correct |
0 ms |
212 KB |
partial |
18 |
Partially correct |
0 ms |
212 KB |
partial |
19 |
Partially correct |
0 ms |
212 KB |
partial |
20 |
Partially correct |
0 ms |
212 KB |
partial |
21 |
Partially correct |
0 ms |
212 KB |
partial |
22 |
Correct |
1 ms |
212 KB |
ok |
23 |
Correct |
0 ms |
212 KB |
ok |
24 |
Partially correct |
0 ms |
212 KB |
partial |
25 |
Partially correct |
0 ms |
212 KB |
partial |
26 |
Partially correct |
0 ms |
212 KB |
partial |
27 |
Partially correct |
0 ms |
212 KB |
partial |
28 |
Partially correct |
0 ms |
212 KB |
partial |
29 |
Partially correct |
0 ms |
212 KB |
partial |
30 |
Partially correct |
3 ms |
292 KB |
partial |
31 |
Partially correct |
2 ms |
212 KB |
partial |
32 |
Partially correct |
1 ms |
212 KB |
partial |
33 |
Partially correct |
1 ms |
212 KB |
partial |
34 |
Correct |
1 ms |
212 KB |
ok |
35 |
Correct |
1 ms |
212 KB |
ok |
36 |
Partially correct |
1 ms |
212 KB |
partial |
37 |
Partially correct |
1 ms |
212 KB |
partial |
38 |
Partially correct |
1 ms |
288 KB |
partial |
39 |
Partially correct |
1 ms |
212 KB |
partial |
40 |
Partially correct |
3 ms |
212 KB |
partial |
41 |
Partially correct |
4 ms |
212 KB |
partial |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
212 KB |
partial |
2 |
Correct |
0 ms |
212 KB |
ok |
3 |
Correct |
0 ms |
212 KB |
ok |
4 |
Correct |
0 ms |
212 KB |
ok |
5 |
Correct |
1 ms |
212 KB |
ok |
6 |
Partially correct |
0 ms |
212 KB |
partial |
7 |
Partially correct |
1 ms |
212 KB |
partial |
8 |
Partially correct |
0 ms |
212 KB |
partial |
9 |
Partially correct |
0 ms |
212 KB |
partial |
10 |
Partially correct |
0 ms |
212 KB |
partial |
11 |
Correct |
0 ms |
212 KB |
ok |
12 |
Correct |
0 ms |
212 KB |
ok |
13 |
Partially correct |
0 ms |
212 KB |
partial |
14 |
Partially correct |
0 ms |
212 KB |
partial |
15 |
Partially correct |
0 ms |
212 KB |
partial |
16 |
Correct |
0 ms |
212 KB |
ok |
17 |
Partially correct |
0 ms |
212 KB |
partial |
18 |
Partially correct |
0 ms |
212 KB |
partial |
19 |
Partially correct |
0 ms |
212 KB |
partial |
20 |
Partially correct |
0 ms |
212 KB |
partial |
21 |
Partially correct |
0 ms |
212 KB |
partial |
22 |
Correct |
1 ms |
212 KB |
ok |
23 |
Correct |
0 ms |
212 KB |
ok |
24 |
Partially correct |
0 ms |
212 KB |
partial |
25 |
Partially correct |
0 ms |
212 KB |
partial |
26 |
Partially correct |
0 ms |
212 KB |
partial |
27 |
Partially correct |
0 ms |
212 KB |
partial |
28 |
Partially correct |
0 ms |
212 KB |
partial |
29 |
Partially correct |
0 ms |
212 KB |
partial |
30 |
Partially correct |
3 ms |
292 KB |
partial |
31 |
Partially correct |
2 ms |
212 KB |
partial |
32 |
Partially correct |
1 ms |
212 KB |
partial |
33 |
Partially correct |
1 ms |
212 KB |
partial |
34 |
Correct |
1 ms |
212 KB |
ok |
35 |
Correct |
1 ms |
212 KB |
ok |
36 |
Partially correct |
1 ms |
212 KB |
partial |
37 |
Partially correct |
1 ms |
212 KB |
partial |
38 |
Partially correct |
1 ms |
288 KB |
partial |
39 |
Partially correct |
1 ms |
212 KB |
partial |
40 |
Partially correct |
3 ms |
212 KB |
partial |
41 |
Partially correct |
4 ms |
212 KB |
partial |
42 |
Incorrect |
16 ms |
3156 KB |
wrong |
43 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
212 KB |
partial |
2 |
Correct |
0 ms |
212 KB |
ok |
3 |
Correct |
0 ms |
212 KB |
ok |
4 |
Correct |
0 ms |
212 KB |
ok |
5 |
Correct |
1 ms |
212 KB |
ok |
6 |
Correct |
0 ms |
212 KB |
ok |
7 |
Correct |
0 ms |
212 KB |
ok |
8 |
Correct |
1 ms |
340 KB |
ok |
9 |
Correct |
15 ms |
2176 KB |
ok |
10 |
Correct |
242 ms |
31656 KB |
ok |
11 |
Partially correct |
0 ms |
212 KB |
partial |
12 |
Partially correct |
1 ms |
212 KB |
partial |
13 |
Partially correct |
0 ms |
212 KB |
partial |
14 |
Partially correct |
0 ms |
212 KB |
partial |
15 |
Partially correct |
0 ms |
212 KB |
partial |
16 |
Correct |
0 ms |
212 KB |
ok |
17 |
Correct |
0 ms |
212 KB |
ok |
18 |
Partially correct |
0 ms |
212 KB |
partial |
19 |
Partially correct |
0 ms |
212 KB |
partial |
20 |
Partially correct |
0 ms |
212 KB |
partial |
21 |
Correct |
0 ms |
212 KB |
ok |
22 |
Partially correct |
0 ms |
212 KB |
partial |
23 |
Partially correct |
0 ms |
212 KB |
partial |
24 |
Partially correct |
0 ms |
212 KB |
partial |
25 |
Partially correct |
0 ms |
212 KB |
partial |
26 |
Partially correct |
0 ms |
212 KB |
partial |
27 |
Correct |
1 ms |
212 KB |
ok |
28 |
Correct |
0 ms |
212 KB |
ok |
29 |
Partially correct |
0 ms |
212 KB |
partial |
30 |
Partially correct |
0 ms |
212 KB |
partial |
31 |
Partially correct |
0 ms |
212 KB |
partial |
32 |
Partially correct |
0 ms |
212 KB |
partial |
33 |
Partially correct |
0 ms |
212 KB |
partial |
34 |
Partially correct |
0 ms |
212 KB |
partial |
35 |
Partially correct |
3 ms |
292 KB |
partial |
36 |
Partially correct |
2 ms |
212 KB |
partial |
37 |
Partially correct |
1 ms |
212 KB |
partial |
38 |
Partially correct |
1 ms |
212 KB |
partial |
39 |
Correct |
1 ms |
212 KB |
ok |
40 |
Correct |
1 ms |
212 KB |
ok |
41 |
Partially correct |
1 ms |
212 KB |
partial |
42 |
Partially correct |
1 ms |
212 KB |
partial |
43 |
Partially correct |
1 ms |
288 KB |
partial |
44 |
Partially correct |
1 ms |
212 KB |
partial |
45 |
Partially correct |
3 ms |
212 KB |
partial |
46 |
Partially correct |
4 ms |
212 KB |
partial |
47 |
Incorrect |
16 ms |
3156 KB |
wrong |
48 |
Halted |
0 ms |
0 KB |
- |