Questions Keep Coming
InterviewTime limit1sMemory limit1024 MB
Each question asks whether all earlier answers in a range x to y were Yes or all were No, and the task is to output the true answer to every question.
- Level
Easy3 of 10
- Topics
- Array, Prefix sum
- Solved
- No attempts yet
Problem
Ningning likes questions that can be answered with yes or no. The answer to Ningning's first question was "Yes".
From the second question on, Ningning keeps asking questions of the following forms:
1 x y: Were the answers to all questions from the -th to the -th all "Yes"?2 x y: Were the answers to all questions from the -th to the -th all "No"?
When Ningning asks one of these questions, you have already answered questions through . Write a program that answers every question Ningning asks.
Input
The first line contains , the number of questions after the first one. In other words, Ningning asks questions in total.
Each of the next lines contains one question in the form 1 x y or 2 x y.
Output
Print lines, the answers to Ningning's questions in order. Print Yes if the answer is "Yes" and No if the answer is "No".
Limits
All given numbers are integers.
- For the -th question (), .