ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

Ural Championship 2004 Round 1

About     Problems     Submit solution     Judge status     Standings
Contest is over

F. Tray

Time limit: 0.5 second
Memory limit: 64 MB
Once I dropped into a cafe to have a snack. I took a first course (a big round plate), a salad (a smaller round plate), and a cup of tea (on a small saucer). I tried to arrange all this on a rectangular tray, which was quite a problem. “Yes, a problem! A nice problem for the Urals Championship!”, I thought.
Now you are to solve this problem. I will give you the size of the tray and of the three plates, and you should try to arrange the plates on the tray.


The input contains the sides of a rectangular H and W and the radii of circles R1, R2, R3. All the numbers are positive integers and do not exceed 106. The numbers are separated with spaces or line breaks.


You should output the only number 0 if the required arrangement is impossible. Otherwise, you should output three pairs of numbers, which are the coordinates of the centers of the plates. The coordinates must be given in the following coordinate system: the origin is the corner of the tray, the X axis is directed along the side of the tray whose length is given first, the Y axis is directed along the other side of the tray. The order of the pairs of coordinates should correspond to the order of the radii given in the input data.


800 400 200 200 50
200.0000 200.0000 600.0000 200.0000 400.0000 350.0000
800 400 200 200 51
Problem Author: Idea - Alexander Petrov, prepared by Alexander Petrov and Alexander Mironenko
Problem Source: VIII Collegiate Students Urals Programming Contest. Yekaterinburg, March 11-16, 2004
To submit the solution for this problem go to the Problem set: 1312. Tray