문제1469--0-1 sequence

1469: 0-1 sequence

실행시간 제한: 4 Sec  메모리사용 제한: 128 MB
제출: 5  통과: 2
[제출] [채점기록] [묻고답하기] [만든사람:]

문제 설명

There is a sequence of 0 and 1.
Let the length of the sequence be N, and if each element of the sequence is numbered sequentially, the first number will be 0, the second number will be 1, and the last number will be N-1.
Let's randomly select two numbers i and j that are greater than or equal to 0 and less than or equal to N-1, and find the maximum and minimum values among the numbers from the i-th to the j-th, and see if the two values are same.

입력 설명

The first line contains a sequence of numbers with a maximum length of 1,000,000. There are no spaces between the numbers.
The next line contains an integer N (N<=100,000) indicating the number of questions.
From the next line, two numbers indicating the corresponding section i and j are entered in N lines.

출력 설명

For each question, if the maximum and minimum values of the corresponding sections i and j are the same, print Yes; otherwise, print No.

입력 예시 Copy

0000011111
3
0 5
4 2
5 9

출력 예시 Copy

No
Yes
Yes

출처/분류