This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "soccer.h"
#include <bits/stdc++.h>
using namespace std;
int biggest_stadium(int N,vector<vector<int>> F){
vector<vector<vector<vector<vector<vector<int>>>>>> DP(N,vector<vector<vector<vector<vector<int>>>>>(N,vector<vector<vector<vector<int>>>>(N,vector<vector<vector<int>>>(N,vector<vector<int>>(N,vector<int>(N))))));
for(int row1=N-1;row1>=0;row1--){
for(int row2=row1;row2<N;row2++){
for(int col1=0;col1<N;col1++){
for(int col2=col1;col2<N;col2++){
if(F[row1][col2])break;
for(int col3=0;col3<N;col3++){
for(int col4=col3;col4<N;col4++){
if(F[row2][col4])break;
if(!(col3<=col1 and col2<=col4) and !(col1<=col3 and col4<=col2))continue;
if(row1==row2) {
DP[row1][row2][col1][col2][col3][col4]=max(col2,col4)-min(col1,col3)+1;
continue;
}
if(row1+1==row2) {
DP[row1][row2][col1][col2][col3][col4]=col2+col4-col1-col3+2;
continue;
}
if(col2-col1<=col4-col3) for(int col5=0;col5<=col1;col5++) {
for(int col6=col2;col6<N;col6++) {
DP[row1][row2][col1][col2][col3][col4]=max(DP[row1][row2][col1][col2][col3][col4],DP[row1+1][row2][col5][col6][col3][col4]+col2-col1+1);
}
}
else for(int col5=0;col5<=col3;col5++) {
for(int col6=col4;col6<N;col6++) {
DP[row1][row2][col1][col2][col3][col4]=max(DP[row1][row2][col1][col2][col3][col4],DP[row1][row2-1][col1][col2][col5][col6]+col4-col3+1);
}
}
}
}
}
}
}
}
int ans = 0;
for(auto&i:DP) {
for(auto&j:i) {
for(auto&k:j) {
for(auto&l:k) {
for(auto&h:l) {
for(auto&o:h) {
ans = max(ans,o);
}
}
}
}
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |