#C1858. Friend Elimination Query
Friend Elimination Query
Friend Elimination Query
You are given a number of test cases. In each test case, you have N friends numbered from 1 to N. A series of elimination operations are applied, where each operation eliminates all friends in a certain interval [L, R]. After performing all operations for that test case, you will be given several queries. For each query, determine whether the specified friend remains (output "Yes") or has been eliminated (output "No").
Note: The elimination operation applies to all friends whose indices lie in the inclusive range [L, R].
The problem simulates a simple elimination scenario and requires handling multiple test cases and performing range updates and queries efficiently. All input and output must be processed via standard input and output.
inputFormat
The input begins with an integer T
representing the number of test cases. For each test case:
- A line containing two integers
N
andM
, whereN
is the number of friends andM
is the number of elimination operations. M
lines follow, each containing two integersL
andR
representing an elimination operation that removes all friends in the inclusive range [L, R].- A line containing an integer
Q
, the number of queries. - A line containing
Q
integers, each representing a friend's index for which you must determine if they are eliminated or not.
All input is read from standard input (stdin).
outputFormat
For each test case, output a single line containing Q
responses separated by spaces. Each response should be "Yes" if the friend is not eliminated, or "No" if they have been eliminated.
All output must be written to standard output (stdout).
## sample1
5 2
1 3
4 5
3
1 3 2
No No No
</p>