#include "soccer.h"
#include <cstdio>
#include <vector>
using namespace std;
// <|°_°|>
const int MAX_ROWS = 2001;
bool Empty[MAX_ROWS][MAX_ROWS];
bool Check(int up, int down, int left, int right) {
// printf("CHECKING : %d %d %d %d\n", up, down, left, right);
int highest = -1;
int low = 1e9;
int leftBorder = 1e9, rightBorder = -1;
for (int i = up; i < down && highest < 0; i ++)
{
for (int j = left; j < right; j ++)
{
if (Empty[i][j])
{
highest = i;
leftBorder = min(leftBorder, j);
if (rightBorder >= 0 && rightBorder < (j - 1))
return 0;
rightBorder = j;
int cur = i;
while (Empty[cur][j])
cur ++;
low = min(low, cur);
}
}
}
rightBorder ++;
if (highest < 0)
return 1;
for (int i = low; i < down; i ++)
{
for (int j = left; j < right; j ++)
{
if (Empty[i][j] && (j < leftBorder || j >= rightBorder))
return 0;
}
}
return Check(up, low, left, leftBorder) && Check(up, low, rightBorder, right) && Check(low, down, leftBorder, rightBorder);
}
int biggest_stadium(int nbRows, vector <vector <int>> Forest) {
int nb = 0;
for (int i = 0; i < nbRows; i ++)
for (int j = 0; j < nbRows; j ++)
nb += Empty[i][j] = !Forest[i][j];
return Check(0, nbRows, 0, nbRows) ? nb : 0;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
344 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Partially correct |
0 ms |
348 KB |
partial |
7 |
Partially correct |
1 ms |
604 KB |
partial |
8 |
Partially correct |
16 ms |
3672 KB |
partial |
9 |
Partially correct |
249 ms |
43664 KB |
partial |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Partially correct |
1 ms |
348 KB |
partial |
4 |
Incorrect |
0 ms |
348 KB |
wrong |
5 |
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 |
Partially correct |
1 ms |
348 KB |
partial |
5 |
Incorrect |
0 ms |
348 KB |
wrong |
6 |
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 |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
344 KB |
ok |
6 |
Partially correct |
1 ms |
348 KB |
partial |
7 |
Incorrect |
0 ms |
348 KB |
wrong |
8 |
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 |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
344 KB |
ok |
6 |
Partially correct |
1 ms |
348 KB |
partial |
7 |
Incorrect |
0 ms |
348 KB |
wrong |
8 |
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 |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
344 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Partially correct |
0 ms |
348 KB |
partial |
8 |
Partially correct |
1 ms |
604 KB |
partial |
9 |
Partially correct |
16 ms |
3672 KB |
partial |
10 |
Partially correct |
249 ms |
43664 KB |
partial |
11 |
Partially correct |
1 ms |
348 KB |
partial |
12 |
Incorrect |
0 ms |
348 KB |
wrong |
13 |
Halted |
0 ms |
0 KB |
- |