Submission #1079507

#TimeUsernameProblemLanguageResultExecution timeMemory
1079507Huseyn123Soccer Stadium (IOI23_soccer)C++17
6 / 100
203 ms39568 KiB
#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)

soccer.cpp: In function 'int biggest_stadium(int, std::vector<std::vector<int> >)':
soccer.cpp:8:9: warning: unused variable 'n' [-Wunused-variable]
    8 |     int n=N;
      |         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...