Submission #939388

#TimeUsernameProblemLanguageResultExecution timeMemory
939388WansurSoccer Stadium (IOI23_soccer)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define f first #define s second #define ent '\n' typedef long long ll; using namespace std; struct seg{ int m1,m2,sum,cnt; }; const string out[2]={"NO\n","YES\n"}; const ll dx[]={0,1,0,-1,-1,1,1,-1}; const ll dy[]={1,0,-1,0,-1,1,-1,1}; const int mod=998244353; const int md=1e9+7; const int mx=2e3+12; const bool T=0; int ptr[512][512][512]; int dp[512][512][512]; int pref[512][512]; int n; int get(int i,int l,int r){ if(!l)return pref[i][r]; return pref[i][r]-pref[i][l-1]; } int biggest_stadium(int N, vector<vector<int>> a) { n = N; if (n > 500) { return 0; } for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ pref[i][j]=a[i][j]; if(j) pref[i][j]+=pref[i][j-1]; } } for(int i=0;i<=n;i++){ for(int j=0;j<=n;j++){ for(int k=0;k<=n;k++){ ptr[i][j][k]=-1; dp[i][j][k]=-1e9; } } } int ans=0; for(int l=0;l<n;l++){ for(int r=l;r<n;r++){ for(int i=0;i<n;i++){ if(get(i,l,r)){ continue; } int j=i; while(j<n-1 && !get(j+1,l,r)){ j++; } ptr[i][l][r]=j; i=j; } } } for(int len=n;len>=1;len--){ for(int l=0;l+len-1<n;l++){ int r=l+len-1; for(int i=0;i<n;i++){ if(ptr[i][l][r]==-1){ continue; } int j=ptr[i][l][r]; dp[i][l][r]=(j-i+1)*(r-l+1); for(int s=i;s<=j;s++) { if(l>0 && ptr[s][l-1][r]!=-1){ int t=ptr[s][l-1][r]; dp[i][l][r]=max(dp[i][l][r], dp[s][l-1][r] + ((j-i+1) - (t-s+1)) * (r-l+1)); } if(r<n-1 && ptr[s][l][r+1]!=-1){ int t=ptr[s][l][r+1]; dp[i][l][r]=max(dp[i][l][r], dp[s][l][r+1] + ((j-i+1) - (t-s+1)) * (r-l+1)); } } ans=max(ans,dp[i][l][r]); i=j; }x` } } return ans; }

Compilation message (stderr)

soccer.cpp:89:15: error: stray '`' in program
   89 |             }x`
      |               ^
soccer.cpp: In function 'int biggest_stadium(int, std::vector<std::vector<int> >)':
soccer.cpp:89:14: error: 'x' was not declared in this scope
   89 |             }x`
      |              ^