Submission #1110540

#TimeUsernameProblemLanguageResultExecution timeMemory
1110540vladiliusSecret (JOI14_secret)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; #define pb push_back #define ff first #define ss second vector<vector<int>> x; vector<int> a; int n, lg; void build(int d, int l, int r){ if (abs(l - r) <= 1) return; int m = (l + r) / 2; x[d][m] = a[m]; for (int i = m - 1; i >= l; i--){ x[d][i] = Secret(x[d][i + 1], a[i]); } x[d][m + 1] = a[m + 1]; for (int i = m + 2; i <= r; i++){ x[d][i] = Secret(x[d][i - 1], a[i]); } build(d + 1, l, m); build(d + 1, m + 1, r); } void Init(int ns, vector<int> A){ n = ns; a.resize(n + 1); for (int i = 1; i <= n; i++){ a[i] = A[i - 1]; } lg = log2(n); x.resize(lg + 1); for (int i = 0; i <= lg; i++){ x[i].resize(n + 1); } build(0, 1, n); } int get(int d, int tl, int tr, int& l, int& r){ int tm = (tl + tr) / 2; if (l <= tm && tm < r){ return Secret(x[d][l], x[d][r]); } return (r <= tm) ? get(d + 1, tl, tm, l, r) : get(d + 1, tm + 1, tr, l, r); } int Query(int l, int r){ l++; r++; if ((l + 1) == r) return Secret(a[l], a[r]); return get(0, 1, n, l, r); }

Compilation message (stderr)

secret.cpp: In function 'void build(int, int, int)':
secret.cpp:18:19: error: 'Secret' was not declared in this scope
   18 |         x[d][i] = Secret(x[d][i + 1], a[i]);
      |                   ^~~~~~
secret.cpp:22:19: error: 'Secret' was not declared in this scope
   22 |         x[d][i] = Secret(x[d][i - 1], a[i]);
      |                   ^~~~~~
secret.cpp: In function 'int get(int, int, int, int&, int&)':
secret.cpp:47:16: error: 'Secret' was not declared in this scope
   47 |         return Secret(x[d][l], x[d][r]);
      |                ^~~~~~
secret.cpp: In function 'int Query(int, int)':
secret.cpp:54:30: error: 'Secret' was not declared in this scope
   54 |     if ((l + 1) == r) return Secret(a[l], a[r]);
      |                              ^~~~~~