Galley Pigs P13333


Statement
 

pdf   zip

Contact with the Americas revolutionized many aspects of life in Europe. Time-honoured traditions and practices that had held for centuries were dramatically changed as new materials, skills, and even vegetables and animals were sailed across the ocean and introduced into societies that had never seen change of that magnitude until then.

0.78

And the art of sailing was one which experienced such an unprecedented revolution after guinea pigs were first encountered by Europeans exploring the Andean region. On their trip back, captains realized that with an ingenious assembly of wheels, axles, and belts, they could propel their galleys in a much more efficient way than with human rowers. Guinea pigs ate in smaller quantities, grain for feeding them was easier to transport, and they were much less likely to organize mutinies that would end with the captain’s head at the end of an oar…

0.22

0.6

The system consisted of a propeller wheel, which moved the ship, together with a series of auxiliary wheels, on which guinea pigs ran to provide the propulsion force. Each wheel had an axle, where one or more transmission belts connected it to other wheels.

0.4

In their race for sailing advantage, seafarers quickly learned to identify the sturdiest and fastest of the rodents, fighting for them in auctions or even resorting to burglary in order to steal them from vessels moored at neighbouring piers. However, greed for speed remained as dangerous as it was with human propulsion: if at any point one of the pigs was pushed to run beyond their maximum natural speed, the poor animal would perish in an ear-piercing squeak of death.

Can you help these optimizing navigators determine if their furry crew will be able to propel their boat without any casualties?

Input

Input consists of several cases. Each case starts with the number of wheels 2W1042 \le W \le 10^4 and the number of belts 1B21041 \le B \le 2 \cdot 10^4.

0.45 After that come WW lines, one for each wheel. The line for a wheel 0w<W0 \le w < W contains the name of the guinea pig that will be on it, the axle and rim radii, both between 1 and 1000, and the maximum speed, between 1 and 10410^4, that the animal can run at.

0.55

The first wheel corresponds to the propeller: it will have a single dash “-” as name, and its speed ss indicates the maximum speed that the captain wants the ship to sail at. All names are “short” and different. All radius and speed values are integers.

Finally come BB pairs xx yy, with xyx \ne y, one for each belt, which are the indices of the wheels it connects, both between 0 and W1W - 1. Belts are always attached to the axle of the wheels they connect, never to the rim.

Output

For each input case, verify the linear speed of each wheel as the propeller’s speed increases from 0 to s0s_0. If all guinea pigs can stand their wheel’s speed, print “Steady as she goes!”. Otherwise, print the name of the first pig that will be crushed by the non-existent centrifugal force followed by “ is no more.”.

There will always be at least one guinea pig moving the ship’s wheel, and there will never be two animals tied in first position. The input cases have no precission issues.

Public test cases
  • Input

    2 1
    - 1 100 200
    Fluffy 20 50 10
    0 1
    
    2 1
    - 1 100 500
    Fluffy 20 50 10
    1 0
    
    4 3
    - 1 100 200
    Fluffy 20 50 10
    Bluffy 15 40 20
    Puffy 20 40 5
    0 1  0 2  2 3
    
    4 4
    - 1 100 200
    Fluffy 20 50 10
    Bluffy 15 40 20
    Puffy 20 40 5
    0 1  0 2  1 3  2 3
    
    4 3
    - 1 100 200
    Fluffy 20 50 10
    Bluffy 15 40 20
    Puffy 10 40 5
    2 0  0 1  3 2
    
    4 2
    - 1 100 200
    Fluffy 20 50 10
    Bluffy 15 40 20
    Puffy 10 40 5
    3 2  1 0
    
    

    Output

    Steady as she goes!
    Fluffy is no more.
    Steady as she goes!
    Steady as she goes!
    Puffy is no more.
    Steady as she goes!
    
  • Information
    Author
    Edgar Gonzalez
    Language
    English
    Official solutions
    C++
    User solutions
    C++