|
||||||||||
Interval queryTime Limit: 30000/15000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2405 Accepted Submission(s): 761 Problem Description This is a very simple question. There are N intervals in number axis, and M queries just like ¡°QUERY(a,b)¡± indicate asking the maximum number of the disjoint intervals between (a,b) . Input There are several test cases. For each test case, the first line contains two integers N, M (0<N, M<=100000) as described above. In each following N lines, there are two integers indicate two endpoints of the i-th interval. Then come M lines and each line contains two integers indicating the endpoints of the i-th query. You can assume the left-endpoint is strictly less than the right-endpoint in each given interval and query and all these endpoints are between 0 and 1,000,000,000. Output For each query, you need to output the maximum number of the disjoint intervals in the asked interval in one line. Sample Input
Sample Output
Author HIT Source | ||||||||||
|