#include using namespace std; #define modulo 998244353 #define mod(mod_x) ((((long long)mod_x+modulo))%modulo) #define Inf 1000000000000000000 int main(){ int N; cin>>N; vector A(N); for(int i=0;i>A[i]; } vector> f,g; int last = 0; for(int i=0;iA[i-1]){ g.emplace_back(last,i-1); last=i; } } g.emplace_back(last,N-1); /* for(int i=0;i>Q; for(int i=0;i>l>>r; auto it1 = lower_bound(f.begin(),f.end(),make_pair(l,0)); auto it2 = lower_bound(f.begin(),f.end(),make_pair(r,0)); if(it1==f.end()||(*it1).first>l)it1--; if(it2==f.end()||(*it2).first>r)it2--; if(it1==it2)cout<<1; else cout<<0; cout<<' '; it1 = lower_bound(g.begin(),g.end(),make_pair(l,0)); it2 = lower_bound(g.begin(),g.end(),make_pair(r,0)); if(it1==g.end()||(*it1).first>l)it1--; if(it2==g.end()||(*it2).first>r)it2--; if(it1==it2)cout<<1; else cout<<0; cout<