#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);
for(auto&x:a) cin>>x;
int ok[n+1][n+1];
for(int i=0;i<n;i++){
ok[i][i]=1;
for(int j=i+1;j<n;j++){
if(a[j]!=a[j-1]) ok[i][j]&=ok[i][j-1];
else ok[i][j]=0;
}
}
for(int queries=0;queries<q;queries++){
int l,r; cin>>l>>r;
l--;r--;
if(ok[l][r]) cout<<"YES\n";
else cout<<"NO\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 |
329 ms |
78168 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
211 ms |
9744 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 |
329 ms |
78168 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |