Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular wmm × h mm sheet of glass, a diamond glass cutter and lots of enthusiasm. What he lacks is understanding of what to carve and how.
In order not to waste time, he decided to practice the technique of carving. To do this, he makes vertical and horizontal cuts through the entire sheet. This process results in making smaller rectangular fragments of glass. Leonid does not move the newly made glass fragments. In particular, a cut divides each fragment of glass that it goes through into smaller fragments.
After each cut Leonid tries to determine what area the largest of the currently available glass fragments has. Since there appear more and more fragments, this question takes him more and more time and distracts him from the fascinating process.
Leonid offers to divide the labor — he will cut glass, and you will calculate the area of the maximum fragment after each cut. Do you agree?
Output
After each cut print on a single line the area of the maximum available glass fragment in mm2.
题意:切玻璃,每切一刀求当前的最大快的面积
思路: 最重要到额一点是找横的最大和竖着的最大
如果用 set,每次把新的长宽插入,然后erase()被破坏的长或者宽
如果用并查集,先把没有切的看成一个整体,然后重后往前依次去掉一条切得线后可以得到新的一个长或者宽
multiset 代码:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
并查集代码:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include