//#include<bits/stdc++.h>
//using namespace std;
//
//#define ll long long
//#define ii pair<int, int>
//#define fi first
//#define se second
//#define pll pair<ll, ll>
//#define vi vector<int>
//#define db long double
//
//const int maxn = 1e6+5;
//const ll mod = 1e9+7;
//const ll inf = 1e18;
//const double eps = 1e-9;
//const double pi = acos(-1);
//const int block_size = 320;
#include "secret.h"
int n, a[maxn];
ll acc[15][1005];
int mask[1005];
void cal(int lev, int l, int r){
if(l == r) return;
int mid = (l+r)/2;
acc[lev][mid] = a[mid];
for(int i=mid-1; i>=l; i--){
acc[lev][i] = Secret(acc[lev][i+1], a[i]);
}
acc[lev][mid+1] = a[mid+1];
for(int i=mid+2; i<=r; i++){
acc[lev][i] = Secret(acc[lev][i-1], a[i]);
}
for(int i=mid+1; i<=r; i++){
mask[i] |= (1<<lev);
}
cal(lev+1, l, mid);
cal(lev+1, mid+1, r);
}
void init(int N, int A[]){
n = N;
for(int i=0; i<n; i++){
a[i] = A[i];
}
cal(0, 0, n-1);
}
int Query(int l, int r){
if(l == r) return a[l];
int lvl = __builtin_ctz(mask[l] ^ mask[r]);
return Secret(acc[lvl][l], acc[lvl][r]);
}
//int main(){
// freopen("ngan.inp", "r", stdin);
// freopen("ngan.out", "w", stdout);
// ios_base::sync_with_stdio(0);
// cin.tie(0); cout.tie(0);
// int test; cin >> test;
// while(test--){
// solve();
// }
//
//}
Compilation message
secret.cpp:21:10: error: 'maxn' was not declared in this scope
21 | int n, a[maxn];
| ^~~~
secret.cpp:22:1: error: 'll' does not name a type
22 | ll acc[15][1005];
| ^~
secret.cpp: In function 'void cal(int, int, int)':
secret.cpp:29:5: error: 'acc' was not declared in this scope
29 | acc[lev][mid] = a[mid];
| ^~~
secret.cpp:29:21: error: 'a' was not declared in this scope
29 | acc[lev][mid] = a[mid];
| ^
secret.cpp: In function 'void init(int, int*)':
secret.cpp:49:9: error: 'a' was not declared in this scope
49 | a[i] = A[i];
| ^
secret.cpp: In function 'int Query(int, int)':
secret.cpp:55:23: error: 'a' was not declared in this scope
55 | if(l == r) return a[l];
| ^
secret.cpp:57:19: error: 'acc' was not declared in this scope
57 | return Secret(acc[lvl][l], acc[lvl][r]);
| ^~~