Submission #1291515

#TimeUsernameProblemLanguageResultExecution timeMemory
1291515sula2Secret (JOI14_secret)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define popcount __builtin_popcount #define all(a) (a).begin(), (a).end() using namespace std; using namespace chrono; using namespace __gnu_pbds; template<typename T> using ordered_set = tree<T,null_type,less_equal<>,rb_tree_tag,tree_order_statistics_node_update>; vector<int> lay[20]; vector<int> mids[20]; void init(int l, int r, vector<int>& a, int dep = 0) { if (l == r) return; int mid = (l+r)/2; lay[dep][mid] = a[mid]; lay[dep][mid+1] = a[mid+1]; for (int i = mid-1; i >= l; i--) lay[dep][i] = Secret(a[i], lay[dep][i+1]); for (int i = mid+2; i <= r; i++) lay[dep][i] = Secret(lay[dep][i-1], a[i]); init(l, mid, a, dep + 1); init(mid+1, r, a, dep + 1); } void Init(int n, int* a) { vector<int> _a(n); for (int i = 0; i < n; i++) _a[i] = a[i]; init(0, n-1, _a); } int Query(int l, int r) { for (int d = 0;; d++) { for (int mid : mids[d]) { if (l <= mid && mid <= r) { return Secret(lay[d][l], lay[d][r]); } } } }

Compilation message (stderr)

secret.cpp: In function 'void init(int, int, std::vector<int>&, int)':
secret.cpp:20:23: error: 'Secret' was not declared in this scope
   20 |         lay[dep][i] = Secret(a[i], lay[dep][i+1]);
      |                       ^~~~~~
secret.cpp:22:23: error: 'Secret' was not declared in this scope
   22 |         lay[dep][i] = Secret(lay[dep][i-1], a[i]);
      |                       ^~~~~~
secret.cpp: In function 'int Query(int, int)':
secret.cpp:38:24: error: 'Secret' was not declared in this scope
   38 |                 return Secret(lay[d][l], lay[d][r]);
      |                        ^~~~~~