Welcome to ZOJ
Select Problem
ZOJ Problem Set - 2763
Prison Break

Time Limit: 10 Seconds      Memory Limit: 32768 KB

After Michael Scofield break out of Fox River, other prisoners hope that they could follow his example. Careful preparation and perfect plan make these guys get close to their goal. However they still meet some trouble. The only road to the outside world has been obstructed. There exists a wall at the end of the road, and at the front of the wall is a wide pit. The prisoners only have a piece of rope. Fortunately they succeed to tie it to a pole in the sky. The scene is like this:

Their method to get out is: Run as quickly as possible and at the end of the road grasp the rope, it's just like single pendulum. When the height equals the height of the wall, release the rope. If the prisoner strikes the wall, he fails. Only those who succeed to fly over the wall can get freedom again.

As a talent programmer, you know whether they will succeed. Please calculate the number of those who succeed and list their names.

Note: Acceleration of gravity is 9.8.


The input contains multiple test cases.

For each test case: The first line is an integer M (1 <= M <= 100) indicating the number of prisoners.
The second line contains three real number, L (length of rope), W (width of pit), H (height of wall).
The following m lines each contain the name (less than 10 letters, not empty, no blank), weight, and speed of a prisoner.


For each test case: Output an integer indicating the number of prisoners who succeed in the first line. Then list their names one in a line, in lexicographic order.

Sample Input:

10.0 6.0 2.0
Michael 60.0 18.0
C-notes 70.0 6.0

Sampel Output:


Author: JIN, Qiang
Source: ZOJ Monthly, September 2006
Submit    Status