#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
int n;
vector<vector<int>> t(15, vector<int>(1000));
void calc(int L, int R, int dep, int A[]) {
if (L == R) {
t[dep][L] = A[L];
return;
}
int m = (L + R) / 2;
t[dep][m] = A[m];
for (int i = m - 1; i >= L; i--) {
t[dep][i] = Secret(A[i], t[dep][i + 1]);
}
t[dep][m + 1] = A[m + 1];
for (int i = m + 2; i <= R; i++) {
t[dep][i] = Secret(A[i], t[dep][i - 1]);
}
calc(L, m, dep + 1, A);
calc(m + 1, R, dep + 1, A);
}
void Init(int N, int A[]) {
n = N;
calc(0, n - 1, 0);
}
int get(int L, int R, int qL, int qR, int dep) {
if (L == R) {
return t[dep][L];
}
int m = (L + R) / 2;
if (qL <= m && m + 1 <= qR) {
return Secret(t[dep][qL], t[dep][qR]);
} else if (qR <= m) {
return get(L, m, qL, qR, dep + 1);
}
return get(m + 1, R, qL, qR, dep + 1);
}
int Query(int L, int R) {
return get(0, n - 1, L, R, 0);
}
// int main() {
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// }
Compilation message
secret.cpp: In function 'void Init(int, int*)':
secret.cpp:28:19: error: too few arguments to function 'void calc(int, int, int, int*)'
28 | calc(0, n - 1, 0);
| ^
secret.cpp:8:6: note: declared here
8 | void calc(int L, int R, int dep, int A[]) {
| ^~~~