CF527C.Glass Carving
普及/提高-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm × 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?
列昂尼德想成为一名玻璃雕刻师(即通过切割玻璃创作精美艺术品的人)。他目前已有一块 w 毫米 × h 毫米的矩形玻璃板、一把金刚石玻璃切割刀,以及满腔热情。但他缺乏的是:该雕刻什么,以及如何雕刻。
为了不浪费时间,他决定先练习切割技巧。为此,他会对整块玻璃板进行垂直和水平切割。这一过程会将玻璃板分割成若干更小的矩形碎片。列昂尼德不会移动新切割出的玻璃碎片。特别地,每一次切割都会将其所经过的每一个玻璃碎片进一步分割为更小的碎片。
每次切割后,列昂尼德都会尝试确定当前所有玻璃碎片中面积最大的那块的面积。由于碎片数量越来越多,这个问题耗费的时间也越来越长,从而分散了他对这门迷人工艺的专注。
列昂尼德提议分工合作——他负责切割玻璃,而你则负责在每次切割后计算最大玻璃碎片的面积。你愿意接受吗?
输入格式
The first line contains three integers w, h, n (2 ≤ w, h ≤ 200 000, 1 ≤ n ≤ 200 000).
Next n lines contain the descriptions of the cuts. Each description has the form H y or V x. In the first case Leonid makes the horizontal cut at the distance y millimeters (1 ≤ y ≤ h - 1) from the lower edge of the original sheet of glass. In the second case Leonid makes a vertical cut at distance x (1 ≤ x ≤ w - 1) millimeters from the left edge of the original sheet of glass. It is guaranteed that Leonid won't make two identical cuts.
第一行包含三个整数 w、h、n(满足 2≤w,h≤200000,1≤n≤200000)。
接下来的 n 行描述了切割操作。每行的格式为 H y 或 V x。在第一种情况下,列昂尼德在距离原始玻璃板底边 y 毫米处进行水平切割(1≤y≤h−1);在第二种情况下,他在距离原始玻璃板左边 x 毫米处进行垂直切割(1≤x≤w−1)。保证列昂尼德不会进行两次完全相同的切割。
输出格式
After each cut print on a single line the area of the maximum available glass fragment in mm2.
每次切割后,在单独一行输出当前可用的最大玻璃碎片的面积(单位:mm²)。
输入输出样例
输入#1
4 3 4 H 2 V 2 V 3 V 1
输出#1
8 4 4 2
输入#2
7 6 5 H 4 V 3 V 5 H 2 V 1
输出#2
28 16 12 6 4
说明/提示
Picture for the first sample test:

Picture for the second sample test:

第一个样例测试的图片:

第二个样例测试的图片:

输入解题思路,AI测评打分。不知道怎么写?