 Roller coaster 

The technicians of a roller coaster are worried, because reading the
manual of the ACME cars that have just installed they have found the
following sentence: “Danger of derailment: these cars are not prepared
to put up with speeds greater than 120 km/h with security”.

—Hey Paco —ask a technician to the other one— ?‘ our roller coaster does
not go so fast, does it?

—?‘How do you want that I know it, Johnny? I am only the one that
tightens the nuts. The only thing that I have is the map of the
trajectory that describes the roller coaster. It is given by a
polynomial p(x) of degree three in the segment [a, b]: the value p(a) is
the height of the initial point, and p(b) is the height of the final
point. ?‘How do you want that I know what speed will go this junk?

Johny remains a while thoughtful.

—I know that the car is stopped in highest point of the roller coaster
(that, by the way, it does not have to match with the extremes a or b).
And I know also that, as the cars do not have motor and the rails do not
do any friction against the wheels (I know it because each morning I oil
them personally) happens something that they taught me in the secondary
school, something about energy conservation: the gravitational potential
energy mgh turns into kinetic energy $\frac{1}{2}mv^2$, or something
like that. I suppose that we could calculate something...

—Yes, sure that we could —answers Paco— But it is late and in half an
hour the Simpsons starts. ?‘What do you think if we do it another day?

—OK.

?‘Are you able to discover if the installation is safe? Assume that the
acceleration of gravity g in the area of the instalation of the roller
coaster is 9.81ms⁻².

Input

The input consists of a line with a number n between 1 and 2000,
followed by n lines. Each line contains 7 real numbers, separated by a
space. The four first numbers c₃, c₂, c₁, c₀ are the coefficients of the
polynomial p(x) of degree three
p(x) = c₃x³ + c₂x² + c₁x¹ + c₀
that describes the roller coaster. The following number is the mass of
the car, and the other two following numbers are the extremes a and b
that describe the initial point and the final point of the roller
coaster.

Your program must solve two inputs as the ones described before in a
time of 1 second.

Output

Your program must print n lines, one line for each presented case: it
must print “No problem” if the instalation is safe (that is, the car
never will pass 120 km/h), and “Crash!” if the instalation is not safe.

In order to avoid rounding problems, we assure you that in all the
inputs the maximal speed is less than 119.9 km/h or greater than 120.1
km/h.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T12:20:28.019Z

© Jutge.org, 2006–2026.
https://jutge.org
