Below is the text of the page https://pc-ua.com.ua/page2489.html stored 2008-10-09 by archive.org.ua. The original page over time could change. View as original html

Задача D

Итоги олимпиады 2005 года -> Задачи основного тура - Задача D [page2553.html] Ваш браузер не поддерживает JavaScript! Альтернативная версия меню без JavaScript здесь Итоги олимпиады 2005 года -> Задачи основного тура Задача D Sum D Harvest (2 sec) Input file: D.IN Output: Standard output The rectangular field of A*B size is sowed by several cultures. They can be sowed in arbitrary order on N rectangular parts of the field (plots) with the sides parallel to the sides of the field. On the intersection of the plots the last sowed culture grows. You are to calculate the area for each culture to gather in the harvest and the area of the field left untouched. Input The first line of the input file contains the only integer which is a number of tests. Then similar groups in N+1 lines for each test follow. First line of each group contains three integers separated by blanks. They are A, B, N (1<=A<=10000, 1<=B<=10000, 1<=N<=1000) which represent correspondingly the width of the field, its length and the number of plots under cultures. Each of the next N lines contains five integers which represent correspondingly abscissa and ordinate of the lower left point of the plot, abscissa and ordinate of the upper right point of the plot and the number of the culture sowed on it. The origin for plots coordinates lies in the lower left point of the field. Numbers in each line are separated by blanks. The numbers of cultures belong to the interval [1,2500]. Output For each test the output file contains several lines. First of them contains one integer which is the area of the field left untouched. The others contain two integers each which represent correspondingly the number of culture in the ascending order and the area under it. Numbers in each line are separated by blanks. If the result area under some culture is zero (it is completely covered by other cultures) you do not output the corresponding line. If there is no area of the field left untouched you do output the corresponding line. Input Output 2 91 20 20 3 2 84 2 2 18 18 2 13 187 0 8 19 19 13 24 38 8 0 10 19 24 0 10 10 2 1 50 0 0 7 10 1 2 50 5 0 10 10 2 Developed by Deep Vision