Given N segments (1-d) and Q numbers, for each of the numbers we have to find the number of segments which contain that number. A number "num" will lie in a segment (A,B) if A ≤ num ≤ B.↵
For example, let the segments are (6 12), (8 8), (10 12), (8 11) and (0 12).↵
Now for any query if the given number is 11(eleven), then the answer is 4.Because the number is contained by 4 segments.↵
Here 1 <= (N,Q) <= 50000↵
[Problem Link : _](http://lightoj.com/volume_showproblem.php?problem=1089_)↵
Some hints on how the problem can be solved using segment tree would be really helpful.
For example, let the segments are (6 12), (8 8), (10 12), (8 11) and (0 12).↵
Now for any query if the given number is 11(eleven), then the answer is 4.Because the number is contained by 4 segments.↵
Here 1 <= (N,Q) <= 50000↵
[Problem Link
Some hints on how the problem can be solved using segment tree would be really helpful.