#include <bits/stdc++.h>
#include "soccer.h"
using namespace std;
int solveA(int r, int i, int j, int N, vector<vector<int>> F) {
if(r == N) return 0;
int best = 0;
for(int l = i; l <= j; l++) {
int k = l;
if(F[r][l] == 1) continue;
while(k <= j && F[r][k] == 0) k++;
best = max(best, k - l + solveA(r + 1, l, k - 1, N, F));
l = k - 1;
}
return best;
}
int solveB(int r, int i, int j, int N, vector<vector<int>> F) {
if(r == -1) return 0;
int best = 0;
for(int l = i; l <= j; l++) {
int k = l;
if(F[r][l] == 1) continue;
while(k <= j && F[r][k] == 0) k++;
best = max(best, k - l + solveB(r - 1, l, k - 1, N, F));
l = k - 1;
}
return best;
}
int solveC(int r, int i, int j, int N, vector<vector<int>> F) {
if(r == N) return 0;
int best = 0;
for(int l = i; l <= j; l++) {
int k = l;
if(F[l][r] == 1) continue;
while(k <= j && F[k][r] == 0) k++;
best = max(best, k - l + solveC(r + 1, l, k - 1, N, F));
l = k - 1;
}
return best;
}
int solveD(int r, int i, int j, int N, vector<vector<int>> F) {
if(r == -1) return 0;
int best = 0;
for(int l = i; l <= j; l++) {
int k = l;
if(F[l][r] == 1) continue;
while(k <= j && F[k][r] == 0) k++;
best = max(best, k - l + solveD(r - 1, l, k - 1, N, F));
l = k - 1;
}
return best;
}
int biggest_stadium(int N, vector<vector<int>> F) {
int A = solveA(0, 0, N - 1, N, F);
int B = solveB(N - 1, 0, N - 1, N, F);
int C = solveC(0, 0, N - 1, N, F);
int D = solveD(N - 1, 0, N - 1, N, F);
return max({A, B, C, D});
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
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 |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
432 KB |
ok |
7 |
Correct |
5 ms |
4696 KB |
ok |
8 |
Correct |
1221 ms |
502908 KB |
ok |
9 |
Runtime error |
1180 ms |
2097152 KB |
Execution killed with signal 9 |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
1 ms |
352 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
436 KB |
ok |
6 |
Correct |
1 ms |
344 KB |
ok |
7 |
Partially correct |
0 ms |
348 KB |
partial |
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 |
432 KB |
ok |
13 |
Incorrect |
0 ms |
348 KB |
wrong |
14 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
1 ms |
352 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
436 KB |
ok |
7 |
Correct |
1 ms |
344 KB |
ok |
8 |
Partially correct |
0 ms |
348 KB |
partial |
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 |
432 KB |
ok |
14 |
Incorrect |
0 ms |
348 KB |
wrong |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
1 ms |
352 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
0 ms |
436 KB |
ok |
9 |
Correct |
1 ms |
344 KB |
ok |
10 |
Partially correct |
0 ms |
348 KB |
partial |
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 |
432 KB |
ok |
16 |
Incorrect |
0 ms |
348 KB |
wrong |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
1 ms |
352 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
0 ms |
436 KB |
ok |
9 |
Correct |
1 ms |
344 KB |
ok |
10 |
Partially correct |
0 ms |
348 KB |
partial |
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 |
432 KB |
ok |
16 |
Incorrect |
0 ms |
348 KB |
wrong |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Correct |
0 ms |
432 KB |
ok |
8 |
Correct |
5 ms |
4696 KB |
ok |
9 |
Correct |
1221 ms |
502908 KB |
ok |
10 |
Runtime error |
1180 ms |
2097152 KB |
Execution killed with signal 9 |
11 |
Halted |
0 ms |
0 KB |
- |