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;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,popcnt,sse4")
const int mxn = 33;
int N;
int dp[mxn][mxn][mxn][mxn];
int biggest_stadium(int NN, std::vector<std::vector<int>> F){
N = NN;
memset(dp,-1,sizeof(dp));
for(int i = 0;i<N;i++){
for(int j = 0;j<N;j++){
for(int k = j;k<N;k++){
if(F[i][k])break;
dp[i][i][j][k] = k-j+1;
}
}
}
for(int wid = 1;wid<N;wid++){
for(int sr = 0;sr+wid<N;sr++){
int er = sr+wid;
for(int l = 0;l<N;l++){
for(int r = l;r<N;r++){
for(int tl = l;tl<=r;tl++){
for(int tr = tl;tr<=r;tr++){
if(dp[sr+1][er][l][r] != -1&&dp[sr][sr][tl][tr] != -1)
dp[sr][er][tl][tr] = max(dp[sr][er][tl][tr],dp[sr+1][er][l][r]+dp[sr][sr][tl][tr]);
if(dp[sr][er-1][l][r] != -1&&dp[er][er][tl][tr] != -1)
dp[sr][er][tl][tr] = max(dp[sr][er][tl][tr],dp[sr][er-1][l][r]+dp[er][er][tl][tr]);
}
}
}
}
}
}
int ans = 0;
for(auto &i:dp)for(auto &j:i)for(auto &ii:j)for(auto &jj:ii)ans = max(ans,jj);
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... |