Problem of the day
Input: ‘N’ = 3, ‘M' = 2, ‘Q’ = 1, ‘ARR’ = [[0, 1], [0, 2]], ‘QUERIES’ = [2]
Output: 2
In this case,
After Day 1 number of coins in the boxes will be: [1, 1, 0]
After Day 2 number of coins in the boxes will be: [2, 2, 1]
Hence the boxes having at least ‘2’ coins are Box 0 and Box 1.
The first line will contain the integer ‘T’, the number of test cases.
Each test case consists of two lines.
The first line of input contains three integers, ‘N’, ‘M’, and ‘Q’ separated by spaces.
Followed by ‘M’ lines, each line contains two integers, ‘L’ and ‘R’.
Followed by ‘Q’ lines, each line contains one integer, ‘X’.
For each test case, print ‘Q’ space separated integers denoting the answers to the ‘Q’ questions asked by Deep.
You don't need to print anything. It has already been taken care of. Just implement the given function.
1 <= ‘T’ <= 10
1 <= ‘N’ <= 10^5
1 <= ‘M’ <= 10^5
1 <= ‘Q’ <= 10^5
0 <= ‘L’ <= ‘R’ <= ‘N-1’
0 <= ‘X’ <= 10^5
It is guaranteed that sum of ‘N’ over all test cases is <= 10^5
It is guaranteed that sum of ‘M’ over all test cases is <= 10^5
It is guaranteed that sum of ‘Q’ over all test cases is <= 10^5
Time Limit: 1 sec
2
5 1 1
1 4
1
7 3 2
0 3
2 6
4 6
0
2
4
7 5
For the first test case,
After Day 1 number of coins in the boxes will be: [0, 1, 1, 1, 1]
Hence the boxes having at least ‘1’ coin are Box 1, 2, 3, and 4.
Hence, the output will be: 4
For the second test case,
After Day 1 number of coins in the boxes will be: [1, 1, 1, 1, 0, 0, 0]
After Day 2 number of coins in the boxes will be: [1, 1, 2, 2, 1, 1, 1]
After Day 3 number of coins in the boxes will be: [1, 1, 2, 2, 2, 2, 2]
All the boxes have at least a ‘1’ coin, hence the answer to the ‘1’st question is ‘7’.
The boxes having at least ‘2’ coins are Box 2, 3, 4, 5, and 6.
Hence, the output will be: 7 5
2
10 3 3
5 9
3 7
2 6
3
0
0
8 4 5
0 0
5 5
4 4
7 7
2
0
4
3
0
2 10 10
0 8 0 0 8