시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 512 MB | 174 | 66 | 55 | 40.146% |
You have been hired at the Nano Wiring Efficient Route Company (NWERC) to help with the design of their new circuit boards. The circuits themselves have already been designed, and your task is to come up with a way to print them onto the blank boards that the company has bought.
More specifically, each circuit design consists of a number of connection points with some connections between them such that the resulting graph is connected and does not have any cycles (i.e., the graph is a tree).
You are free to place the connection points anywhere on the circuit board and solder the connections between them so that no two connections intersect (except at the connection points). The boards you ordered are fairly large, so there is no danger of running out of space. You can solder so precisely that connections and connection points can be considered infinitesimal.
This would all be very easy, however your boss persists that each connection needs to be a straight line of length exactly 1 mm (this is, so he says, to make sure the electrons do not have to travel around corners, which would be detrimental to the efficiency of the design).
You soon realise that battling with him will be unsuccessful. Your quickest way out of this is to etch a new design according to his specifications.
The input consists of:
It is guaranteed that these edges describe a valid tree.
Output n lines, the ith of which contains two real numbers xi, yi, the coordinates of point i. To make the production feasible, the following restrictions apply:
If there are multiple valid solutions, you may output any one of them.
5 1 2 1 3 1 4 1 5
0.0000000 0.0000000 1.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 -1.0000000
5 2 1 3 1 2 4 2 5
40 40 40.7071067812 40.7071067812 41 40 41.7071067812 40.7071067812 40 41.4142135624
ICPC > Regionals > Europe > Northwestern European Regional Contest > NWERC 2018 C번