#include "soccer.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int biggest_stadium(int N, vector<vector<int>> F) {
auto sum = [&](vector<vector<int>> v) -> int {
int good = 0;
for (int sx = 0; sx < N; ++sx) for (int sy = 0; sy < N; ++sy) {
good += v[sx][sy];
}
return good;
};
int good = N*N - sum(F);
int ans = 0;
for (int sx = 0; sx < N; ++sx) for (int sy = 0; sy < N; ++sy) {
if (F[sx][sy]) continue;
vector<vector<int>> cur(N, vector<int>(N));
for (int i = sx; i < N; ++i) {
if (F[i][sy]) break;
cur[i][sy] = 1;
}
for (int i = sx; i >= 0; --i) {
if (F[i][sy]) break;
cur[i][sy] = 1;
}
for (int j = sy; j < N; ++j) {
if (F[sx][j]) break;
cur[sx][j] = 1;
}
for (int j = sy; j >= 0; --j) {
if (F[sx][j]) break;
cur[sx][j] = 1;
}
const int dx[] = {1, 1, -1, -1};
const int dy[] = {1, -1, 1, -1};
for (int d = 0; d < 4; ++d) {
for (int i = sx + dx[d]; i < N && i >= 0; i += dx[d]) {
for (int j = sy + dy[d]; j < N && j >= 0; j += dy[d]) {
// cerr << "|" << i << " " << j << '\n';
if (cur[i - dx[d]][j] && cur[i][j - dy[d]] && !F[i][j]) {
cur[i][j] = 1;
}
}
}
}
ans = max(ans, sum(cur));
// cerr << sx << " " << sy << '\n';
// for (int i = 0; i < N; ++i) {
// for (int j = 0; j < N; ++j) {
// cerr << cur[i][j];
// }
// cerr << '\n';
// }
if (ans == good) break;
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
604 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 |
Correct |
0 ms |
344 KB |
ok |
7 |
Correct |
273 ms |
572 KB |
ok |
8 |
Execution timed out |
4551 ms |
5100 KB |
Time limit exceeded |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
604 KB |
ok |
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 |
348 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Incorrect |
0 ms |
348 KB |
wrong |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
1 ms |
604 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 |
0 ms |
348 KB |
ok |
8 |
Incorrect |
0 ms |
348 KB |
wrong |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
1 ms |
604 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 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Correct |
0 ms |
348 KB |
ok |
10 |
Incorrect |
0 ms |
348 KB |
wrong |
11 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
1 ms |
604 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 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Correct |
0 ms |
348 KB |
ok |
10 |
Incorrect |
0 ms |
348 KB |
wrong |
11 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
1 ms |
604 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 |
Correct |
0 ms |
344 KB |
ok |
8 |
Correct |
273 ms |
572 KB |
ok |
9 |
Execution timed out |
4551 ms |
5100 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |