prithivMLmods/Coder-Stat
Coder-Stat Dataset Overview The Coder-Stat dataset is a collection of programming-related data, including problem IDs, programming languages, original statuses, and source code snippets. This dataset is designed to assist in the analysis of coding patterns, error types, and performance metrics. Dataset Details Modalities Tabular: The dataset is structured in a tabular format. Text: Contains text data, including source code snippets.… See the full description on the dataset page: https://huggingface.co/datasets/prithivMLmods/Coder-Stat.
3139
1 2<h1><font color="#000">Problem C:</font> Cut the Cake</h1>3<!-- end en only -->4 5 6<p>7Today is the birthday of Mr. Bon Vivant, who is known as one of the greatest <i>pâtissiers</i> in the world.8Those who are invited to his birthday party are <i>gourmets</i> from around the world.9They are eager to see and eat his extremely creative cakes.10Now a large box-shaped cake is being carried into the party.11It is not beautifully decorated and looks rather simple, but it must be delicious beyond anyone's imagination.12Let us cut it into pieces with a knife and serve them to the guests attending the party.13</p>14<!-- end en only -->15 16 17 18<!-- begin en only -->19<p>20The cake looks rectangular, viewing from above (Figure C-1).21As exemplified in Figure C-2, the cake will iteratively be cut into pieces, where on each cut exactly a single piece is cut into two smaller pieces.22Each cut surface must be orthogonal to the bottom face and must be orthogonal or parallel to a side face.23So, every piece shall be rectangular looking from above and every side face vertical.24</p>25<!-- end en only -->26 27<center>28<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_c-1"><br><br>29<!-- begin en only -->30Figure C-1: The top view of the cake 31<!-- end en only -->32</center>33 34<center>35<br>36<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_c-2"><br><br>37<!-- begin en only -->38Figure C-2: Cutting the cake into pieces39<!-- end en only -->40</center>41 42<!-- begin en only -->43<p>44Piece sizes in Figure C-2 vary significantly and it may look unfair, but you don't have to worry.45Those guests who would like to eat as many sorts of cakes as possible often prefer smaller pieces.46Of course, some prefer larger ones.47</p>48<!-- end en only -->49<!-- begin en only -->50<p>Your mission of this problem is to write a computer program that simulates the cutting process of the cake and reports the size of each piece.51</p>52<!-- end en only -->53 54 55<h2>Input</h2>56 57<!-- begin en only -->58<p>59The input is a sequence of datasets, each of which is of the following format.60</p>61<!-- end en only -->62 63<blockquote>64<i>n</i> <i>w</i> <i>d</i><br>65<i>p</i><sub>1</sub> <i>s</i><sub>1</sub><br>66...<br>67<i>p<sub>n</sub></i> <i>s<sub>n</sub></i><br>68</blockquote>69 70<!-- begin en only -->71<p>72The first line starts with an integer <i>n</i> that is between 0 and 100 inclusive.73It is the number of cuts to be performed.74The following <i>w</i> and <i>d</i> in the same line are integers between 1 and 100 inclusive.75They denote the width and depth of the cake, respectively.76Assume in the sequel that the cake is placed so that <i>w</i> and <i>d</i> are the lengths in the east-west and north-south directions, respectively.77</p>78<!-- end en only -->79 80<!-- begin en only -->81<p>82Each of the following <i>n</i> lines specifies a single cut, cutting one and only one piece into two.83<i>p<sub>i</sub></i> is an integer between 1 and <i>i</i> inclusive and is the identification number of the piece that is the target of the <i>i</i>-th cut.84Note that, just before the <i>i</i>-th cut, there exist exactly <i>i</i> pieces.85Each piece in this stage has a unique identification number that is one of 1, 2, ..., <i>i</i> and is defined as follows:86</p>87<!-- end en only -->88 89<!-- begin en only -->90<ul>91<li>92The earlier a piece was born, the smaller its identification number is.93<li>94Of the two pieces born at a time by the same cut, the piece with the smaller area (looking from above) has the smaller identification number.95If their areas are the same, you may define as you like the order between them, since your choice in this case has no influence on the final answer.96</ul>97<!-- end en only -->98 99<!-- begin en only -->100<p>101Note that identification numbers are adjusted after each cut.102</p>103<!-- end en only -->104 105<!-- begin en only -->106<p>107<i>s<sub>i</sub></i> is an integer between 1 and 1000 inclusive and specifies the starting point of the <i>i</i>-th cut.108From the northwest corner of the piece whose identification number is <i>p<sub>i</sub></i>, you can reach the starting point by traveling <i>s<sub>i</sub></i> in the clockwise direction around the piece. 109You may assume that the starting point determined in this way cannot be any one of the four corners of the piece.110The <i>i</i>-th cut surface is orthogonal to the side face on which the starting point exists.111<!-- end en only -->112 113<!-- begin en only -->114<p>115The end of the input is indicated by a line with three zeros.116</p>117<!-- end en only -->118 119 120<h2>Output</h2>121 122<!-- begin en only -->123<p>124For each dataset, print in a line the areas looking from above of all the pieces that exist upon completion of the <i>n</i> cuts specified in the dataset.125They should be in ascending order and separated by a space.126When multiple pieces have the same area, print it as many times as the number of the pieces.127</p>128<!-- end en only -->129 130<h2>Sample Input</h2>131 132<pre>1333 5 61341 181352 191361 21373 4 11381 11392 11403 11410 2 51420 0 0143</pre>144 145 146<h2>Output for the Sample Input</h2>147 148<pre>1494 4 6 161501 1 1 115110152</pre>153 154 