Good algorithm for a query related problem
问题 Given N pairs, we have to find the count of pairs that contain an element k in their range, i.e : If a Pair i is defined as (X i ,Y i ), then if Pair i contain K in its range, then X i <= K <= Y i . Now we are given Q such queries to handle with each query consisting of an integer K. Input: The first line contains two space-separated integers N and Q. Next N lines follow where each line denotes a pair. Each line contains two space-separated integers. Next Q lines follow where each line