#include "soccer.h"
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
int biggest_stadium(int n, vector<vector<int>> F){
vector<vector<vector<vector<int>>>> dp(n,
vector<vector<vector<int>>>(n, vector<vector<int>>(n, vector<int>(n, 0))));
auto mx = dp;
for(int i = 0; i < n; i++){
for(int l = 0; l < n; l++) for(int r = l; r < n; r++){
if(F[i][r]) break;
dp[i][i][l][r] = r-l+1;
mx[i][i][l][r] = r-l+1;
}
for(int l = 0; l < n; l++) for(int r = n-1; r >= l; r--){
if(l) mx[i][i][l][r] = max(mx[i][i][l][r], mx[i][i][l-1][r]);
if(r+1 < n) mx[i][i][l][r] = max(mx[i][i][l][r], mx[i][i][l][r+1]);
}
}
for(int a = n-1; a >= 0; a--) for(int b = a+1; b < n; b++) for(int l = 0; l < n; l++) for(int r = n-1; r >= l; r--){
if(dp[a][a][l][r] != 0) dp[a][b][l][r] = max(dp[a][b][l][r], mx[a+1][b][l][r]+dp[a][a][l][r]);
if(dp[b][b][l][r] != 0) dp[a][b][l][r] = max(dp[a][b][l][r], mx[a][b-1][l][r]+dp[b][b][l][r]);
mx[a][b][l][r] = max(mx[a][b][l][r], dp[a][b][l][r]);
if(l) mx[a][b][l][r] = max(mx[a][b][l][r], mx[a][b][l-1][r]);
if(r+1 < n) mx[a][b][l][r] = max(mx[a][b][l][r], mx[a][b][l][r+1]);
}
int ans = 0;
for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) for(int k = 0; k < n; k++)
for(int l = 0; l < n; l++) ans = max(ans, dp[i][j][k][l]);
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
344 KB |
ok |
3 |
Correct |
1 ms |
348 KB |
ok |
4 |
Correct |
1 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Partially correct |
0 ms |
348 KB |
partial |
7 |
Partially correct |
1008 ms |
862352 KB |
partial |
8 |
Runtime error |
2589 ms |
2097152 KB |
Execution killed with signal 9 |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
344 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
1 ms |
352 KB |
ok |
5 |
Correct |
1 ms |
504 KB |
ok |
6 |
Correct |
1 ms |
344 KB |
ok |
7 |
Correct |
0 ms |
436 KB |
ok |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Correct |
1 ms |
344 KB |
ok |
10 |
Correct |
0 ms |
348 KB |
ok |
11 |
Incorrect |
0 ms |
344 KB |
wrong |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
344 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
1 ms |
352 KB |
ok |
6 |
Correct |
1 ms |
504 KB |
ok |
7 |
Correct |
1 ms |
344 KB |
ok |
8 |
Correct |
0 ms |
436 KB |
ok |
9 |
Correct |
0 ms |
348 KB |
ok |
10 |
Correct |
1 ms |
344 KB |
ok |
11 |
Correct |
0 ms |
348 KB |
ok |
12 |
Incorrect |
0 ms |
344 KB |
wrong |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
344 KB |
ok |
4 |
Correct |
1 ms |
348 KB |
ok |
5 |
Correct |
1 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Correct |
1 ms |
352 KB |
ok |
8 |
Correct |
1 ms |
504 KB |
ok |
9 |
Correct |
1 ms |
344 KB |
ok |
10 |
Correct |
0 ms |
436 KB |
ok |
11 |
Correct |
0 ms |
348 KB |
ok |
12 |
Correct |
1 ms |
344 KB |
ok |
13 |
Correct |
0 ms |
348 KB |
ok |
14 |
Incorrect |
0 ms |
344 KB |
wrong |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
344 KB |
ok |
4 |
Correct |
1 ms |
348 KB |
ok |
5 |
Correct |
1 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Correct |
1 ms |
352 KB |
ok |
8 |
Correct |
1 ms |
504 KB |
ok |
9 |
Correct |
1 ms |
344 KB |
ok |
10 |
Correct |
0 ms |
436 KB |
ok |
11 |
Correct |
0 ms |
348 KB |
ok |
12 |
Correct |
1 ms |
344 KB |
ok |
13 |
Correct |
0 ms |
348 KB |
ok |
14 |
Incorrect |
0 ms |
344 KB |
wrong |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
344 KB |
ok |
4 |
Correct |
1 ms |
348 KB |
ok |
5 |
Correct |
1 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Partially correct |
0 ms |
348 KB |
partial |
8 |
Partially correct |
1008 ms |
862352 KB |
partial |
9 |
Runtime error |
2589 ms |
2097152 KB |
Execution killed with signal 9 |
10 |
Halted |
0 ms |
0 KB |
- |