| Problem Statement | |
| -------- | |
| AtCoder has decided to place web advertisements of $n$ companies on the top page. | |
| The space for placing advertisements is a square of size 10000 x 10000. | |
| The space for each company must be an axis-parallel rectangle with positive area, and the coordinates of the vertices must be integer values. | |
| Different rectangles may touch on their sides, but they must not overlap. In other words, the common area must not have positive area. | |
| It is allowed to leave some free space that does not belong to any ad. | |
| President Takahashi asked each company for their desired location and area. Company $i$ wants an ad space with area $r_i$ including point $(x_i+0.5, y_i+0.5)$. | |
| The satisfaction level $p_i$ of company $i$ is determined as follows. | |
| - If the ad space for company $i$ does not contain the point $(x_i+0.5, y_i+0.5)$, then $p_i = 0$. | |
| - If the ad space for company $i$ contains the point $(x_i+0.5, y_i+0.5)$ and the area is $s_i$, then $p_i = 1 - (1 - \min(r_i,s_i) / \max(r_i, s_i))^2$. | |
| Your task is to determine the placement of the ads so that the sum of the satisfaction levels is maximized. | |
| You will get a score of $10^9 \times \sum_{i=0}^{n-1} p_i / n$ rounded to the nearest integer. | |
|  | |
| Input | |
| -------- | |
| Input is given from Standard Input in the following format: | |
| ~~~ | |
| $n$ | |
| $x_0$ $y_0$ $r_0$ | |
| $\vdots$ | |
| $x_{n-1}$ $y_{n-1}$ $r_{n-1}$ | |
| ~~~ | |
| - $50\leq n\leq 200$ | |
| - $x_i$ and $y_i$ are integers satisfying $0\leq x_i\leq 9999$ and $0\leq y_i\leq 9999$. For any $i\neq j$, $(x_i,y_i)\neq (x_j,y_j)$ holds. | |
| - $r_i$ is an integer at least one and satisfies $\sum_{i=0}^{n-1} r_i=10000\times 10000$. | |
| Output | |
| -------- | |
| Let $(a_i, b_i)$ and $(c_i, d_i)$ ($0\leq a_i<c_i\leq 10000$, $0\leq b_i<d_i\leq 10000$) be the coordinates of the two diagonal vertices of the rectangle representing the ad space for company $i$. | |
| Output to standard output in the following format. | |
| ~~~ | |
| $a_0$ $b_0$ $c_0$ $d_0$ | |
| $\vdots$ | |
| $a_{n-1}$ $b_{n-1}$ $c_{n-1}$ $d_{n-1}$ | |
| ~~~ | |
| Input Generation | |
| -------- | |
| Let $rand()$ be a function that generates a uniformly random double-precision floating point number at least zero and less than one. | |
| #### Generation of $n$ | |
| The number of companies $n$ is generated by rounding $50 × 4^{rand()}$ to the nearest integer value. | |
| #### Generation of $x_i$ and $y_i$ | |
| The list of desired locations $(x_1,y_i),\ldots,(x_n,y_n)$ is generated by randomly sampling $n$ distinct coordinates from $\\{(x, y) \mid x\in \\{0,1,\ldots,9999\\}, y\in\\{0,1,\ldots,9999\\}\\}$. | |
| #### Generation of $r_i$ | |
| Let $q_1,\ldots,q_{n-1}$ be a sorted list of $n-1$ distinct integers randomly sampled from $\\{1,2,\ldots,99999999\\}$. | |
| Let $q_0=0$ and $q_n=100000000$. | |
| Then $r_i=q_{i+1}-q_i$. | |
| Number of test cases | |
| -------- | |
| - Provisional test: 50 | |
| - System test: 1000. We will publish seeds.txt (md5=8fc1ce3f4beabac6abc1bdb4206d7f7e) after the contest is over. | |
| The score of a submission is the total scores for each test case. | |
| In the provisional test, if your submission produces illegal output or exceeds the time limit for some test cases, the submission itself will be judged as WA or TLE, and the score of the submission will be zero. | |
| In the system test, if your submission produces illegal output or exceeds the time limit for some test cases, only the score for those test cases will be zero. | |
| Tools | |
| -------- | |
| You can download an input generator and visualizer <a href="https://img.atcoder.jp/ahc001/ded8fd3366b4ff0b0d7d053f553cdb84.zip">here</a>. | |
| To use them, you need a compilation environment of <a href="https://www.rust-lang.org/ja">Rust language</a>. | |
| {sample example} | |