#pragma region #pragma GCC target("avx2") #pragma GCC optimize("03") #pragma GCC optimize("unroll-loops") #include using namespace std; typedef long double ld; typedef long long ll; typedef unsigned long long ull; #define endl "\n" #define FOR(i,a,b) for(int i=(a);i<=(b);i++) #define rep(i,a,b) for(int i=(a);i<(b);i++) #define PII pair #define PLL pair #define ALL(x) (x).begin(), (x).end() constexpr int INF=1<<30; constexpr ll LINF=1LL<<60; constexpr ll mod=1e9+7; constexpr int NIL = -1; templateinline bool chmax(T &a, const T &b) { if (ainline bool chmin(T &a, const T &b) { if (b> n; rep(i,0,n) cin >> a[i]; vector inc(n); vector dec(n); rep(i,0,n) { if(i != 0 and a[i-1] <= a[i]) inc[i] = 1; if(i != 0 and a[i-1] >= a[i]) dec[i] = 1; } rep(i,1,n) { inc[i] += inc[i-1]; dec[i] += dec[i-1]; } // rep(i,1,n) { // cout << inc[i]; // } int Q; cin >> Q; while(Q--) { int l, r; cin >> l >> r; if(inc[r]-inc[l] == r-l) cout << 1 << " "; else cout << 0 << " "; if(dec[r]-dec[l] == r-l) cout << 1 << endl; else cout << 0 << endl; } return 0; }