Hrastovi
The government is planing to build a walkway for tourists in the middle of an oak forest. The forest can be represented as plane with N special lattice points representing oaks. The walkway is represented as a rectangle with sides parallel to the axes. If the sides of walkway rectangle intersect any oak lattice points, such oaks need to be axed down. Oaks inside the rectangle do not represent problems and need not be cut down. Ljubo is the state secretary of Forestry and an passionate nature lover, so he ordered the secretary of Tourism to provide him with a list of P possible rectangle walkways that are attractive enough to draw in tourists.
Ljubo plans to select the walkway that needs the smallest amount of oak trees to be cut down. Since we also like trees, would you be so kind and write a program that will determine the number of oaks that will be cut down for each walkway. Remember only the oaks intersecting the sides of the rectangle need to be cut.
6
1 2
3 2
2 3
2 5
4 4
6 3
4
2 2 4 4
2 2 6 5
3 3 5 6
5 1 6 6Output:
3
4
0
1Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.