Submission #725711

# Submission time Handle Problem Language Result Execution time Memory
725711 2023-04-17T23:41:11 Z josanneo22 Alternating Heights (CCO22_day1problem1) C++17
0 / 25
166 ms 12720 KB
#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
1 Incorrect 166 ms 12720 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 151 ms 11000 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 166 ms 12720 KB Output isn't correct
2 Halted 0 ms 0 KB -