#include #include #include #include #include #include #include #include #define ll long long #define sz(x) int(x.size()) #define all(x) x.begin(),x.end() using namespace std; void Fast_IO(){ ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr); #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout); #endif } void solve(){ ll n,q; cin>>n>>q; vectorv; ll small[100005]{}; ll big[100005]{}; ll j =1; for(int i=0; i>x; v.push_back(x); if(i>0){ if(v[i-1]<=v[i]){ small[i]=j; small[i+1]=j; }else if(v[i-1]>=v[i]){ big[i]=j; big[i+1]=j; } } if(i>1){ if(v[i-1]v[i]&& v[i-1]>v[i-2]){ big[i]=j+1; j++; } } } // big[n]=big[n-1]; // small[n]=small[n-1]; // for(int i=1; i<=n; i++){ // cout<>l>>r; if(l==r){ cout<<"Yes\n"; continue; } else if(r-l==1){ cout<<"Yes\n"; continue; } if(v[l-1]==v[r-1]){ if(small[l]==small[r] || big[l]==big[r]) cout<<"Yes\n"; else cout<<"No\n"; } else if(v[l-1]>v[r-1]){ if(big[l]==big[r]){ cout<<"Yes\n"; }else cout<<"No\n"; } else{ if(small[l]==small[r]){ cout<<"Yes\n"; }else cout<<"No\n"; } } } int main(){ Fast_IO(); int t =1; //cin>>t; while(t--){ solve(); } return 0; }