This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int rd(){
int x=0,w=1;
char ch=getchar();
for(;ch>'9'||ch<'0';ch=getchar()) if(ch=='-') w=-1;
for(;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
return x*w;
}
void solve(){
int n,k,q; cin>>n>>k>>q;
vector<int> a(n);
unordered_map<int,vector<int>> pos;
for(int i=0;i<n;i++){
cin>>a[i];
pos[a[i]].push_back(i);
}
for(int que=0;que<q;que++){
int l,r; cin>>l>>r;
l--;r--;
if(r-l+1>2){
cout<<"NO\n";
}
else{
if(l==r) cout<<"YES\n";
else if(a[l]==a[r]) cout<<"NO\n";
else cout<<"YES\n";
}
}
}
signed main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
int tt=1; //cin>>tt;
while(tt--){
solve();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |