//#pragma optimization_level 3
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#include"secret.h"
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordset;
*/
#define fr first
#define sc second
#define vec vector
#define pb push_back
#define pii pair<int, int>
#define forn(x,y) for(ll x = 1 ; x <= y ; ++x)
#define all(x) (x).begin(),(x).end()
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef pair<ll,ll> pll;
const int nmax = 100005;
const ll linf = 1e17;
const ll mod = 1e9+7;
const int inf = 1e9+7;
const ll lim = 1e4;
int n, a[nmax];
map < pii , int > cl;
map < pii , int > rg;
int Ask(int a, int b){
if( cl[make_pair(a,b)] != 0){
return cl[make_pair(a,b)];
}
else
return cl[make_pair(a,b)] = Secret(a,b);
}
int Ask_range(int l , int r){
assert(rg[make_pair(l,r)] != 0);
return rg[make_pair(l,r)];
}
void make_range(int l , int r){
if(l == r){
return;
}
int mid = (l+r)>>1;
int as = a[mid];
int bs = a[mid+1];
for(int i = mid - 1 ; i >= l ; i--){
as = Ask(a[i],as);
rg[make_pair(i,mid)] = as;
}
for(int i = mid + 2 ; i <= r ; i++){
bs = Ask(bs,a[i]);
rg[make_pair(mid+1,i)] = bs;
}
make_range(l,mid);
make_range(mid+1,r);
}
void Init(int N , int A[]){
n = N;
forn(i,n){
a[i] = A[i-1];
}
make_range(1,n);
}
int qr(int l, int r , int lt , int rt){
int mid = (lt+rt)>>1;
if(r <= mid){
return qr(l,r,lt,mid);
}
if(l >= mid + 1){
return qr(l,r,mid+1,rt);
}
return Ask(Ask_range(l,mid),Ask_range(mid+1,r));
}
int Query(int L , int R){
L++, R++;
if( L == R ){
return a[L];
}
if( L == R - 1){
return Ask(a[L],a[R]);
}
return qr(l,r,1,n);
}
Compilation message
secret.cpp: In function 'int Query(int, int)':
secret.cpp:100:12: error: 'l' was not declared in this scope
return qr(l,r,1,n);
^
secret.cpp:100:14: error: 'r' was not declared in this scope
return qr(l,r,1,n);
^