Pro.ID10154 TitleShaping Regions Title链接http://10.20.2.8/oj/exercise/problem?problem_id=10154 AC18 Submit30 Ratio60.00% 时间&空间限制描述N opaque rectangles (1 ≤ N ≤ 1000) of various colors are placed on a white sheet of paper whose size is A wide by B long. The rectangles are put with their sides parallel to the sheet's borders. All rectangles fall within the borders of the sheet so that different figures of different colors will be seen. The coordinate system has its origin (0,0) at the sheet's lower left corner with axes parallel to the sheet's borders. 输入The order of the input lines dictates the order of laying down the rectangles. The first input line is a rectangle "on the bottom".
输出Description N opaque rectangles (1 ≤ N ≤ 1000) of various colors are placed on a white sheet of paper whose size is A wide by B long. The rectangles are put with their sides parallel to the sheet's borders. All rectangles fall within the borders of the sheet so that different figures of different colors will be seen. The coordinate system has its origin (0,0) at the sheet's lower left corner with axes parallel to the sheet's borders. Input The order of the input lines dictates the order of laying down the rectangles. The first input line is a rectangle "on the bottom".
Output The output file should contain a list of all the colors that can be seen along with the total area of each color that can be seen (even if the regions of color are disjoint), ordered by increasing color. Do not display colors with no area. Sample Input 20 20 3 Sample Output 1 91 Hint
Shaping Regions: Hint 1An array of all 'points' is too big; 16MB maximum. Keep track of the rectangles' coordinates; split the rectangle when an overlap occurs, e.g.: +--------+ +-+--+--+ Source 样例输入20 20 3 样例输出1 91 提示
Shaping Regions: Hint 1An array of all 'points' is too big; 16MB maximum. Keep track of the rectangles' coordinates; split the rectangle when an overlap occurs, e.g.: +--------+ +-+--+--+ |