luogu#P4793. [AHOI2008] 矩形藏宝地
[AHOI2008] 矩形藏宝地
Problem Description
The most famous game on Happy Island is a treasure-hunting game. Xiaokeke arrives at the treasure burial area, which is an open field. The treasures are buried scattered underground in this field, and the task now is to dig them out one by one.
To indicate possible treasure locations, the organizers treat this open field as the first quadrant (including the origin and the positive coordinate axes). They divide all possible treasure locations into rectangular plots, and provide the coordinates of these rectangular plots to the contestants.
The hint for digging is very simple: if a certain rectangular plot is contained in at least one other rectangular plot, then there must be a treasure buried inside that rectangular plot.
In fact, these treasures are exquisite souvenirs. Whoever digs up a souvenir gets to keep it. Xiaokeke wants to end this journey perfectly, and with your help he is full of confidence. You only need to tell him: how many rectangular plots are guaranteed to contain a treasure.
Victory is just ahead. Keep it up.
Input Format
The first line contains an integer , indicating the number of rectangles.
The next lines each contain integers , describing a rectangle. Here, is the coordinate of the lower-left corner, and is the coordinate of the upper-right corner. Each value or value appears at most once.
Output Format
Contains only one integer, the number of rectangular plots that are guaranteed to contain a treasure.
3
0 0 5 5
1 2 3 4
2 1 4 3
2
Hint
In of the testdata, .
In of the testdata, .
In of the testdata, .
In all testdata, each value or value appears at most once. The coordinate range is .
Translated by ChatGPT 5