#C6399. Temperature Safety Check
Temperature Safety Check
Temperature Safety Check
You are given a series of temperature readings. Your task is to determine if all the readings are within a specified admissible temperature range. Specifically, you are given an integer n representing the number of temperature readings, an integer m (which is provided but not used in the logic), followed by n integer temperature readings. Finally, you are given two integers, L and H, representing the lower and upper bounds of the safe range respectively. A reading T is considered safe if it satisfies the condition \( L \leq T \leq H \).
If all the readings are within the interval \([L, H]\), output Safe
. Otherwise, output Unsafe
.
inputFormat
The input is taken from stdin and consists of three lines:
- The first line contains two integers n and m.
- The second line contains n space-separated integers representing the temperature readings.
- The third line contains two integers L and H, the lower and upper bounds of the permissible temperature range.
outputFormat
Output a single line to stdout containing the string Safe
if all temperature readings are within the range \([L, H]\); otherwise, output Unsafe
.
5 10
1 2 3 4 5
-5 5
Safe