/// This code was written by KareemBenzeema
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define fast ios_base::sync_with_stdio(0) ;cin.tie(0) ; cout.tie(0) ;
#define pf push_front
#define pob pop_back
#define pof pop_front
#define gcd __gcd
#define mod (ll) 1e6+3
#define inf (ll) 1e9+9
#define all(x) (x).begin(),(x).end()
#define len(x) (int)(x).size()
#define endl '\n'
using namespace std ;
inline void setio(string ) ;
int main()
{
fast ;
int n , k , q ; cin>>n>>k>>q ;
int arr[n+2] ;
for (int i=0;i<n;i++) cin>>arr[i] ;
for (int i=n-1;i>0;i--) arr[i] = arr[i]==arr[i-1] ? 1 : 0 ;
arr[0] = 0 ;
for (int i=1;i<n;i++) arr[i]+= arr[i-1] ;
for (;q--;){
int l , r ; cin>>l>>r ;
l-- ; r-- ;
cout<<(arr[r]-arr[l]==0 ? "YES" : "NO")<<endl ;
}
return 0 ;
}
inline void setio(string s)
{
freopen((s+".in").c_str(),"r",stdin) ;
freopen((s+".out").c_str(),"w",stdout) ;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
177 ms |
12576 KB |
Output is correct |
2 |
Correct |
180 ms |
12664 KB |
Output is correct |
3 |
Correct |
178 ms |
12576 KB |
Output is correct |
4 |
Correct |
140 ms |
7160 KB |
Output is correct |
5 |
Correct |
149 ms |
9220 KB |
Output is correct |
6 |
Correct |
170 ms |
12628 KB |
Output is correct |
7 |
Correct |
172 ms |
12648 KB |
Output is correct |
8 |
Correct |
178 ms |
12612 KB |
Output is correct |
9 |
Correct |
189 ms |
12692 KB |
Output is correct |
10 |
Correct |
178 ms |
13072 KB |
Output is correct |
11 |
Correct |
184 ms |
13856 KB |
Output is correct |
12 |
Correct |
179 ms |
12876 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
173 ms |
11160 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
177 ms |
12576 KB |
Output is correct |
2 |
Correct |
180 ms |
12664 KB |
Output is correct |
3 |
Correct |
178 ms |
12576 KB |
Output is correct |
4 |
Correct |
140 ms |
7160 KB |
Output is correct |
5 |
Correct |
149 ms |
9220 KB |
Output is correct |
6 |
Correct |
170 ms |
12628 KB |
Output is correct |
7 |
Correct |
172 ms |
12648 KB |
Output is correct |
8 |
Correct |
178 ms |
12612 KB |
Output is correct |
9 |
Correct |
189 ms |
12692 KB |
Output is correct |
10 |
Correct |
178 ms |
13072 KB |
Output is correct |
11 |
Correct |
184 ms |
13856 KB |
Output is correct |
12 |
Correct |
179 ms |
12876 KB |
Output is correct |
13 |
Incorrect |
173 ms |
11160 KB |
Output isn't correct |
14 |
Halted |
0 ms |
0 KB |
- |