Submission #656563

#TimeUsernameProblemLanguageResultExecution timeMemory
656563Tuanlinh123Secret (JOI14_secret)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; map <pair<int, int>, int> Map; int a[1005], NN; void prep(int l, int r) { if (r-l<=1) return; int mid=(l+r)/2; int crr=a[mid-1]; for (int i=mid-2; i>=l; i--) { crr=Secret(a[i], crr); Map[{i, mid-1}]=crr; } crr=a[mid]; for (int i=mid+1; i<=r; i++) { crr=Secret(crr, a[i]); Map[{mid, i}]=crr; } prep(l, mid-1); prep(mid+1, r); } void Init(int n, int A[]) { NN=n; for (int i=0; i<n; i++) { a[i]=A[i]; Map[{i, i}]=a[i]; } prep(0, n-1); } int Find(int L, int R, int tl, int tr) { int mid=(L+R)/2; if (mid>=tl && mid<=tr) return mid; if (mid<tl) return Find(mid+1, R, tl, tr); return Find(L, mid-1, tl, tr); } int Query(int L, int R) { if (L==R) return a[L]; if (L+1==R) return Secret(a[L], a[R]); int mid=Find(0, NN-1, L, R); if (mid==L) return Map[{mid, R}]; return Secret(Map[{L, mid-1}], Map[{mid, R}]); }

Compilation message (stderr)

secret.cpp: In function 'void prep(int, int)':
secret.cpp:15:13: error: 'Secret' was not declared in this scope
   15 |         crr=Secret(a[i], crr);
      |             ^~~~~~
secret.cpp:21:13: error: 'Secret' was not declared in this scope
   21 |         crr=Secret(crr, a[i]);
      |             ^~~~~~
secret.cpp: In function 'int Query(int, int)':
secret.cpp:54:16: error: 'Secret' was not declared in this scope
   54 |         return Secret(a[L], a[R]);
      |                ^~~~~~
secret.cpp:58:12: error: 'Secret' was not declared in this scope
   58 |     return Secret(Map[{L, mid-1}], Map[{mid, R}]);
      |            ^~~~~~