# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1079507 | Huseyn123 | Soccer Stadium (IOI23_soccer) | C++17 | 203 ms | 39568 KiB |
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 dp[501][501][501];
int r[501][501][501];
int biggest_stadium(int N, std::vector<std::vector<int>> F)
{
int n=N;
int cnt,x,y;
cnt=x=y=0;
for(int i=0;i<N;i++){
for(int j=0;j<N;j++){
if(F[i][j]){
x=i;
y=j;
cnt++;
}
}
}
if(cnt==1){
return N*N-min(x+1,N-x)*min(y+1,N-y);
}
int res=0;
for(int i=0;i<N;i++){
int l=0;
for(int j=0;j<N;j++){
if(F[i][j]){
l=j+1;
}
else{
r[i][i][l]=j;
dp[i][i][l]=j-l+1;
}
}
}
for(int i=1;i<=N;i++){
for(int j=0;j<N;j++){
int z=j+i-1;
if(j){
for(int k=0;k<N;k++){
if(dp[j][z][k]){
int l=k;
for(int ind=k;ind<=r[j][z][k];ind++){
if(F[j-1][ind]){
l=ind+1;
}
else{
dp[j-1][z][l]=max(dp[j-1][z][l],ind-l+1+dp[j][z][k]);
r[j-1][z][l]=ind;
}
}
}
}
}
}
}
for(int i=0;i<N;i++){
for(int j=i;j<N;j++){
for(int z=0;z<N;z++){
res=max(res,dp[i][j][z]);
}
}
}
return res;
}
Compilation message (stderr)
# | 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... |