#include "bits/stdc++.h"
//#define int long long
#define all(v) v.begin() , v.end()
#define sz(a) (int)a.size()
using namespace std;
#include "soccer.h"
int dp[8][8][8][8][8][8];
vector<vector<int>> ar;
int ans=0,n;
const int INF = 1e7;
int calc(int a,int b,int c,int d,int e,int f){
if(dp[a][b][c][d][e][f]!=-1) return dp[a][b][c][d][e][f];
int cevv=0;
for(int i=b;i<=c;i++) if(ar[a][i]) return dp[a][b][c][d][e][f]=-INF;
for(int i=e;i<=f;i++) if(ar[d][i]) return dp[a][b][c][d][e][f]=-INF;
if(a>0){
for(int i=0;i<n;i++){
for(int j=i;j<n;j++){
if(ar[a-1][j]) break;
if(b<=i && j<=c && ((i<=e && f<=j) || (e<=i && j<=f)) ) cevv=max(cevv,calc(a-1,i,j,d,e,f)+j-i+1);
}
}
}
if(d+1<n){
for(int i=0;i<n;i++){
for(int j=i;j<n;j++){
if(ar[d+1][j]) break;
if(e<=i && j<=f && ((i<=b && c<=j) || (b<=i && j<=c)) ) cevv=max(cevv,calc(a,b,c,d+1,i,j)+j-i+1);
}
}
}
return dp[a][b][c][d][e][f]=cevv;
}
int biggest_stadium(int N, vector<vector<int>> xd){
memset(dp,-1,sizeof(dp));
ar=xd;n=N;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
for(int k=j;k<n;k++){
if(ar[i][k]) break;
ans=max(ans,calc(i,j,k,i,j,k)+k-j+1);
}
}
}
return ans;
}
/*void _(){
}
int32_t main(){
cin.tie(0); ios::sync_with_stdio(0);
int tc=1;//cin >> tc;
while(tc--) _();
return 0;
}*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1368 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1368 KB |
ok |
2 |
Correct |
1 ms |
1372 KB |
ok |
3 |
Runtime error |
6 ms |
2484 KB |
Execution killed with signal 11 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1368 KB |
ok |
2 |
Correct |
1 ms |
1372 KB |
ok |
3 |
Correct |
1 ms |
1372 KB |
ok |
4 |
Correct |
1 ms |
1372 KB |
ok |
5 |
Correct |
1 ms |
1372 KB |
ok |
6 |
Correct |
1 ms |
1372 KB |
ok |
7 |
Correct |
1 ms |
1372 KB |
ok |
8 |
Correct |
1 ms |
1372 KB |
ok |
9 |
Correct |
1 ms |
1372 KB |
ok |
10 |
Correct |
1 ms |
1396 KB |
ok |
11 |
Correct |
1 ms |
1372 KB |
ok |
12 |
Correct |
1 ms |
1372 KB |
ok |
13 |
Correct |
1 ms |
1372 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1368 KB |
ok |
2 |
Correct |
1 ms |
1368 KB |
ok |
3 |
Correct |
1 ms |
1372 KB |
ok |
4 |
Correct |
1 ms |
1372 KB |
ok |
5 |
Correct |
1 ms |
1372 KB |
ok |
6 |
Correct |
1 ms |
1372 KB |
ok |
7 |
Correct |
1 ms |
1372 KB |
ok |
8 |
Correct |
1 ms |
1372 KB |
ok |
9 |
Correct |
1 ms |
1372 KB |
ok |
10 |
Correct |
1 ms |
1372 KB |
ok |
11 |
Correct |
1 ms |
1396 KB |
ok |
12 |
Correct |
1 ms |
1372 KB |
ok |
13 |
Correct |
1 ms |
1372 KB |
ok |
14 |
Correct |
1 ms |
1372 KB |
ok |
15 |
Correct |
2 ms |
1460 KB |
ok |
16 |
Correct |
1 ms |
1372 KB |
ok |
17 |
Correct |
1 ms |
1372 KB |
ok |
18 |
Correct |
1 ms |
1372 KB |
ok |
19 |
Correct |
1 ms |
1372 KB |
ok |
20 |
Correct |
1 ms |
1372 KB |
ok |
21 |
Correct |
1 ms |
1372 KB |
ok |
22 |
Incorrect |
1 ms |
1372 KB |
wrong |
23 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1368 KB |
ok |
2 |
Correct |
1 ms |
1368 KB |
ok |
3 |
Correct |
1 ms |
1372 KB |
ok |
4 |
Runtime error |
6 ms |
2484 KB |
Execution killed with signal 11 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1368 KB |
ok |
2 |
Correct |
1 ms |
1368 KB |
ok |
3 |
Correct |
1 ms |
1372 KB |
ok |
4 |
Runtime error |
6 ms |
2484 KB |
Execution killed with signal 11 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1368 KB |
ok |
2 |
Correct |
1 ms |
1368 KB |
ok |
3 |
Correct |
1 ms |
1372 KB |
ok |
4 |
Runtime error |
6 ms |
2484 KB |
Execution killed with signal 11 |
5 |
Halted |
0 ms |
0 KB |
- |