#include <bits/stdc++.h> using namespace std; typedef long long ll; constexpr int N = 1e6+10 ; constexpr int inf = 1e9+10 ; int fi[N][21],fa[N][21],a[N]; int fma(int l,int r){ int k=log2(r-l+1); return max(fa[l][k],fa[r-(1<<k)+1][k]); } int fmi(int l,int r){ int k=log2(r-l+1)...