Submission #546742

#TimeUsernameProblemLanguageResultExecution timeMemory
546742krit3379Secret (JOI14_secret)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define N 1005 int n,dp[N][N]; void sol(int l,int r,int type,int *a){ if(l==r)return void(dp[l][r]=a[l]); int mid=(l+r)/2; sol(l,mid,type,a); sol(mid+1,r,type,a); if(type==1)for(int i=l;i<=mid;i++)dp[i][r]=Secret(dp[i][mid],dp[mid+1][r]); else for(int i=mid+1;i<=r;i++)dp[l][i]=Secret(dp[l][mid],dp[mid+1][i]); } void Init(int nn, int *a){ n=nn; for(int i=0;i<n;i++)for(int j=0;j<n;j++)dp[i][j]=-1; sol(0,(n-1)/2,1,a); if(n>1)sol((n-1)/2+1,n-1,2,a); } int Query(int ll, int rr){ int l=0,r=n-1; if(ll==rr)return dp[ll][rr]; if(ll<=(n-1)/2&&rr>(n-1)/2)return Secret(dp[ll][(n-1)/2],dp[(n-1)/2+1][rr]); while(l<=r){ int mid=(l+r)/2; if(ll<=mid&&mid<rr)return Secret(dp[ll][mid],dp[mid+1][rr]); if(rr<=mid)r=mid; else l=mid+1; } }

Compilation message (stderr)

secret.cpp: In function 'void sol(int, int, int, int*)':
secret.cpp:12:48: error: 'Secret' was not declared in this scope
   12 |     if(type==1)for(int i=l;i<=mid;i++)dp[i][r]=Secret(dp[i][mid],dp[mid+1][r]);
      |                                                ^~~~~~
secret.cpp:13:44: error: 'Secret' was not declared in this scope
   13 |     else for(int i=mid+1;i<=r;i++)dp[l][i]=Secret(dp[l][mid],dp[mid+1][i]);
      |                                            ^~~~~~
secret.cpp: In function 'int Query(int, int)':
secret.cpp:26:39: error: 'Secret' was not declared in this scope
   26 |     if(ll<=(n-1)/2&&rr>(n-1)/2)return Secret(dp[ll][(n-1)/2],dp[(n-1)/2+1][rr]);
      |                                       ^~~~~~
secret.cpp:29:35: error: 'Secret' was not declared in this scope
   29 |         if(ll<=mid&&mid<rr)return Secret(dp[ll][mid],dp[mid+1][rr]);
      |                                   ^~~~~~