Sometimes in life, there comes a moment when you want to hear answers to your queries.
Such a moment has come in Sergey’s life. He invented a very interesting problem and gave it to you to solve.
He has an array , which consists only of s and s, and you can perform the following operation on it:
You can choose any subsegment of the array of length 2 \cdot k, consisting of exactly zeros and ones, and repaint all the zeros into ones.
The array will be considered good if you manage to repaint the entire array into ones.
However, since Sergey is going through a difficult period in his life, he decided to complicate his problem and give you queries of the form [l, r]. You need to respond to the query by stating whether the subsegment [l, r] of array is good.
The first line contains three integers , , (1 \le n, k, q \le 10^6) — the length of the array , the number , and the number of queries.
The second line contains integers a_1, a_2, \dots, a_n (0 \le a_i \le 1) — Sergey’s array.
Each of the next lines contains two integers and (1 \le l; l+2 \cdot k-1 \le r \le n) — Sergey’s queries.
You need to answer each query. If the array is not good, output «NO», otherwise output «YES».
Example 1
Query : Subarray [1,0,1,0,0,1,0,0,0,1]. First move on : subarray [1,0,1,0,0,1] has zeros and ones, repaint \to [1,1,1,1,1,1,0,0,0,1]. Second move on . Answer: YES.
Query : Subarray [0,1,1,1,1,0,0] — it is impossible to cover all zeros with permissible operations. Answer: NO.
Query : Subarray [0,0,1,0,1,1,1]. Move on : [0,0,1,0,1,1] — zeros, ones, one move completes. Answer: YES.
Query : Subarray [0,0,0,1,0,1,1] — zeros, ones. This is impossible to accomplish. Answer: NO.
Query : Subarray [1,0,1,0,0,1] — exactly zeros and ones, one move for the entire segment. Answer: YES.
( points): q = 1; l_1 = 1; r_1 = n;
( points): n \le 10;
( points): n,q \le 5\,000;
( points): l_i = 1;
( points): k = 1;
( points): k \le 50;
( points): r_i - l_i + 1 = 4 \cdot k;
( points): If the answer is «YES», then it can be done in just one operation.
( points): Without additional constraints.