Submission #725711

#TimeUsernameProblemLanguageResultExecution timeMemory
725711josanneo22Alternating Heights (CCO22_day1problem1)C++17
0 / 25
166 ms12720 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...