// incorrect/bf_rec_wa.cpp
#include "soccer.h"
#include <iostream>
class solver
{
int N;
std::vector<std::vector<int>> C;
int ans;
void explore_stadium(int row, int globalX, int globalY, int currX, int currY, int state, int cells)
{
ans = std::max(ans, cells);
if (row < N)
{
for (int j = 0; j < N; j++)
{
for (int k = j; k < N; k++)
{
if (0 == C[row][k])
{
if ((j <= globalX && globalY <= k) ||
(globalX <= j && k <= globalY))
{
if (0 == state)
{
if (j <= currX && currY <= k)
{
explore_stadium(row + 1, globalX, globalY, j, k, 0, cells + (k - j + 1));
}
else if (currX <= j && k <= currY)
{
explore_stadium(row + 1, globalX, globalY, j, k, 1, cells + (k - j + 1));
}
}
else
{
if (currX <= j && k <= currY)
{
explore_stadium(row + 1, globalX, globalY, j, k, 1, cells + (k - j + 1));
}
}
}
}
else
{
break;
}
}
}
}
}
public:
solver(int N, std::vector<std::vector<int>> C) : N(N), C(std::move(C)), ans(0) {}
int solve()
{
for (int i = 0; i < N; i++)
{
for (int j = 0; j < N; j++)
{
for (int k = j; k < N; k++)
{
if (0 == C[i][k])
{
explore_stadium(i + 1, j, k, j, k, 0, k - j + 1);
}
else
{
break;
}
}
}
}
return ans;
}
};
int biggest_stadium(int N, std::vector<std::vector<int>> C)
{
solver s(N, C);
return s.solve();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
ok |
2 |
Correct |
1 ms |
212 KB |
ok |
3 |
Execution timed out |
4573 ms |
212 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
ok |
2 |
Correct |
1 ms |
212 KB |
ok |
3 |
Correct |
1 ms |
212 KB |
ok |
4 |
Correct |
1 ms |
212 KB |
ok |
5 |
Correct |
1 ms |
212 KB |
ok |
6 |
Correct |
1 ms |
212 KB |
ok |
7 |
Correct |
1 ms |
348 KB |
ok |
8 |
Correct |
1 ms |
296 KB |
ok |
9 |
Correct |
1 ms |
212 KB |
ok |
10 |
Correct |
0 ms |
212 KB |
ok |
11 |
Correct |
1 ms |
284 KB |
ok |
12 |
Correct |
1 ms |
212 KB |
ok |
13 |
Correct |
1 ms |
212 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
ok |
2 |
Correct |
0 ms |
212 KB |
ok |
3 |
Correct |
1 ms |
212 KB |
ok |
4 |
Correct |
1 ms |
212 KB |
ok |
5 |
Correct |
1 ms |
212 KB |
ok |
6 |
Correct |
1 ms |
212 KB |
ok |
7 |
Correct |
1 ms |
212 KB |
ok |
8 |
Correct |
1 ms |
348 KB |
ok |
9 |
Correct |
1 ms |
296 KB |
ok |
10 |
Correct |
1 ms |
212 KB |
ok |
11 |
Correct |
0 ms |
212 KB |
ok |
12 |
Correct |
1 ms |
284 KB |
ok |
13 |
Correct |
1 ms |
212 KB |
ok |
14 |
Correct |
1 ms |
212 KB |
ok |
15 |
Correct |
42 ms |
276 KB |
ok |
16 |
Correct |
6 ms |
212 KB |
ok |
17 |
Correct |
1 ms |
212 KB |
ok |
18 |
Correct |
1 ms |
212 KB |
ok |
19 |
Correct |
1 ms |
212 KB |
ok |
20 |
Correct |
1 ms |
212 KB |
ok |
21 |
Correct |
1 ms |
212 KB |
ok |
22 |
Incorrect |
0 ms |
212 KB |
wrong |
23 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
ok |
2 |
Correct |
0 ms |
212 KB |
ok |
3 |
Correct |
1 ms |
212 KB |
ok |
4 |
Execution timed out |
4573 ms |
212 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
ok |
2 |
Correct |
0 ms |
212 KB |
ok |
3 |
Correct |
1 ms |
212 KB |
ok |
4 |
Execution timed out |
4573 ms |
212 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
ok |
2 |
Correct |
0 ms |
212 KB |
ok |
3 |
Correct |
1 ms |
212 KB |
ok |
4 |
Execution timed out |
4573 ms |
212 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |