#include #define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i]; #define ft first #define sc second #define pb push_back #define lb lower_bound #define ub upper_bound #define all(v) (v).begin(),(v).end() #define LB(a,x) lb(all(a),x)-a.begin() #define UB(a,x) ub(all(a),x)-a.begin() #define mod 1000000007 #define FS fixed< using V=vector; using Graph = vector>; using P=pair; typedef unsigned long long ull; typedef long double ldouble; template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } const ll INF=1e18; class Segtree{ public: ll N=1; ll dat[500000]; explicit Segtree(ll sz){ while(N0){ k=(k-1)/2; dat[k]=min(dat[2*k+1],dat[2*k+2]); } } ll min_query(ll a,ll b,ll k,ll l,ll r){ if(r<=a||b<=l)return INF; if(a<=l&&r<=b)return dat[k]; ll m=(l+r)/2; ll u=min_query(a,b,2*k+1,l,m); ll v=min_query(a,b,2*k+2,m,r); return min(u,v); } //Range Maximum Query --------------------------- void max_init(){ for(int i=0;i0){ k=(k-1)/2; dat[k]=max(dat[2*k+1],dat[2*k+2]); } } ll max_query(ll a,ll b,ll k,ll l,ll r){ if(r<=a||b<=l)return -INF; if(a<=l&&r<=b)return dat[k]; ll m=(l+r)/2; ll u=max_query(a,b,2*k+1,l,m); ll v=max_query(a,b,2*k+2,m,r); return max(u,v); } //Range Sum Query ----------------------------- void sum_update(ll k,ll a){ k+=N-1; dat[k]+=a; while(k>0){ k=(k-1)/2; dat[k]=(dat[2*k+1]+dat[2*k+2]); } } ll sum_query(ll a,ll b,ll k,ll l,ll r){ if(r<=a||b<=l)return 0LL; if(a<=l&&r<=b)return dat[k]; ll m=(l+r)/2; ll u=sum_query(a,b,2*k+1,l,m); ll v=sum_query(a,b,2*k+2,m,r); return (u+v); } //その他---------------------------------------- /* ll unit(){ return ; } ll calc(ll a,ll b){ return ;//演算 } void update(ll k,ll a){ k+=N-1; dat[k]=a; while(k>0){ k=(k-1)/2; dat[k]=calc(dat[2*k+1],dat[2*k+2]); } } ll query(ll a,ll b,ll k,ll l,ll r){ if(r<=a||b<=l)return unit(); if(a<=l&&r<=b)return dat[k]; ll m=(l+r)/2; ll u=min_query(a,b,2*k+1,l,m); ll v=min_query(a,b,2*k+2,m,r); return calc(u,v); } */ }; int main(){ cin.tie(0);ios::sync_with_stdio(false); ll n; cin>>n; V a(n); cinf(n,a); Segtree f(n),g(n); rep(i,n-1){ if(a[i]>a[i+1]) f.sum_update(i,1); if(a[i]>qq; while(qq--){ ll l,r; cin>>l>>r; ll get_f=f.sum_query(l,r,0,0,f.N); ll get_g=g.sum_query(l,r,0,0,g.N); if(get_f>=1)cout<<"0 "; else cout<<"1 "; if(get_g>=1)cout<<"0"< a(m)でm==0というものはできない) modはなるべく最後に取れ! doubleを扱うときには(abs)ではなく'fabs'!!! */