Submission #624465

#TimeUsernameProblemLanguageResultExecution timeMemory
624465ertoSecret (JOI14_secret)C++17
Compilation error
0 ms0 KiB
#include "secret.h" int n; int ans[1005][1005]; void calc(int lb, int rb, int A[]){ int mid = (lb + rb) / 2; if(lb == rb)return; ans[mid][mid] = A[mid - 1]; for(int i=mid - 1; i>=lb; i--){ ans[mid][i] = Secret(A[i - 1], ans[mid][i + 1]); } ans[mid + 1][mid + 1] = A[mid]; for(int i=mid + 2; i<=rb; i++){ ans[mid + 1][i] = Secret(ans[mid + 1][i - 1], A[i - 1]); } calc(lb, mid, A[]); calc(mid + 1, rb, A[]); } void Init(int N, int A[]){ n = N; calc(1, n, A); } int Query(int L, int R){ L++; R++; int a = 1, b = n; if(L == R)return A[L - 1]; else{ while(a < b){ int mid = (a + b) / 2; if(L <= mid && mid < R){ return Secret(ans[mid][L], ans[mid][R]); } else if(mid == R){ return ans[mid][L]; } else if(mid < L){ a = mid + 1; } else{ l = mid; } } } } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); int T = 1; // cin>>T; while (T--){ solve(); } }

Compilation message (stderr)

secret.cpp: In function 'void calc(int, int, int*)':
secret.cpp:19:21: error: expected primary-expression before ']' token
   19 |     calc(lb, mid, A[]);
      |                     ^
secret.cpp:20:25: error: expected primary-expression before ']' token
   20 |     calc(mid + 1, rb, A[]);
      |                         ^
secret.cpp: In function 'int Query(int, int)':
secret.cpp:32:22: error: 'A' was not declared in this scope
   32 |     if(L == R)return A[L - 1];
      |                      ^
secret.cpp:46:17: error: 'l' was not declared in this scope
   46 |                 l = mid;
      |                 ^
secret.cpp: In function 'int main()':
secret.cpp:53:5: error: 'ios_base' has not been declared
   53 |     ios_base::sync_with_stdio(0);
      |     ^~~~~~~~
secret.cpp:54:5: error: 'cin' was not declared in this scope
   54 |     cin.tie(0);
      |     ^~~
secret.cpp:58:9: error: 'solve' was not declared in this scope
   58 |         solve();
      |         ^~~~~