LCC/Moose '19 Contest 3 S1 - How Cold?

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 64M

Problem type

After a particularly bad blizzard, one news station announced that "while it was cold during this snowstorm, it does not compare to the three coldest temperatures ever recorded in North America, which in order are X, Y, and Z."

Ashley looked at the three numbers and was surprised to see that they were not in increasing order. After some thinking, she realized that maybe X, Y, and Z are in different units, either Fahrenheit or Celsius depending on the country in which they were taken. This would mean that the three numbers might be in order under some assignment of units.

Could you help Ashley figure out if such an assignment exists?

Note: To convert from Celsius to Fahrenheit, multiply by 1.8 and add 32. For example, 10 degrees Celsius is 10 \times 1.8 + 32 = 50 degrees Fahrenheit.

Input Specification

The input contains three distinct integers X, Y, Z (-100 \leq X, Y, Z \leq 100), the three coldest recorded temperatures.

Output Specification

Output Possible if an assignment of units exists such that the three temperatures are in a strictly increasing order from coldest to warmest in the same unit; otherwise output Impossible.

Sample Input 1

-57 -60 -55

Sample Output 1


Sample Input 2

1 33 0

Sample Output 2


Explanation of Sample Input

In the first case, -57 degrees Celsius is approximately -70 degrees Fahrenheit, which makes the three temperatures ordered from coldest to warmest.

In the second case, 0 degrees in either units will not be greater than 33 degrees in either units, so this case is impossible.


There are no comments at the moment.