#P7290. 「EZEC-5」暴力出奇迹
「EZEC-5」暴力出奇迹
Description
Given a plane with vertical line segments. The -th segment has endpoints and .
There are queries. Each query gives . Consider all horizontal segments connecting and for . For these horizontal segments, ask what is the maximum number of vertical segments that a segment can intersect.
A vertical segment with endpoints and intersects a horizontal segment with endpoints and if and only if and . Note that when two segments share an endpoint, if other segments pass through this shared point, it is still counted as an intersection.
Input Format
The first line contains an integer .
The next lines each contain two integers , representing the two endpoints of the -th vertical segment. It is guaranteed that .
Then a line contains an integer .
The next lines each contain four integers, representing one query: .
Output Format
For each query, output one line with one integer, representing the answer.
10
1 8
5 9
5 6
2 8
3 7
4 5
3 7
6 7
3 9
5 10
10
2 4 2 5
5 9 8 10
2 9 3 6
3 7 6 9
1 10 2 9
4 5 1 7
9 10 4 9
2 3 6 9
1 7 6 7
3 10 3 4
2
3
4
3
7
7
1
2
2
2
Hint
Note: This problem uses bundled testdata. You can only get the score for a subtask after you pass all test points in that subtask.
For of the data, , , and .
Below are the old Constraints
For of the data, it is Sample 1.
For another of the data, .
For another of the data, .
For another of the data, .
For another of the data, .
For another of the data, .
For of the data, , , and .
Translated by ChatGPT 5
京公网安备 11011102002149号