Submission #396269

#TimeUsernameProblemLanguageResultExecution timeMemory
396269Killer2501Secret (JOI14_secret)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "secret.h" #define pll pair<ll, ll> #define fi first #define se second #define pb push_back #define task "hopscotch" #define pii pair<ll, pll> using namespace std; using ll = long long; const int N = 1e3+55; const ll mod = 998244353; const ll base = 350; const ll cs = 331; ll m, n, t, k, P[N][12], ans, tong, b[N]; void build(int id, int l, int r) { if(l == r) { return; } ll mid = (l + r) / 2; P[mid][id] = b[id]; for(int i = mid-1; i >= l; i --)P[i][id] = Secret(a[i], P[i+1][id]); for(int i = mid+1; i <= r; i ++)P[i][id] = Secret(a[i], P[i-1][id]); build(id+1, l, mid-1); build(id+1, mid+1, r); } int get(int id, int l, int r, int u, int v) { ll mid = (l + r) / 2; if(l == r)return -1; if(u <= mid && mid <= v)return id; if(mid < u)return get(id+1, l, mid-1, u, v); else return get(id+1, mid+1, r, u, v); } void Init(int n, int a[]) { for(int i = 0; i < n; i ++)b[i] = a[i]; build(0, 0, n-1); } int Query(int l, int r) { int id = get(0, 0, n-1, l, r); if(id == -1)return b[l]; return Secret(P[l][id], P[r][id]); }

Compilation message (stderr)

secret.cpp: In function 'void build(int, int, int)':
secret.cpp:24:55: error: 'a' was not declared in this scope
   24 |     for(int i = mid-1; i >= l; i --)P[i][id] = Secret(a[i], P[i+1][id]);
      |                                                       ^
secret.cpp:25:55: error: 'a' was not declared in this scope
   25 |     for(int i = mid+1; i <= r; i ++)P[i][id] = Secret(a[i], P[i-1][id]);
      |                                                       ^