Extreme Temperatures
InterviewTime limit2sMemory limit512 MB
Read lines that pair a date with integer temperatures and print the smallest and largest values across every measurement.
- Level
Easy1 of 10
- Topics
- Implementation, Array, String, Brute force
- Solved
- No attempts yet
Problem
Kristen is a meteorologist who monitors extreme temperatures in the forest of Palaiseau. She has collected temperature measurements taken at various times over several days. Help her find the lowest and highest temperatures in her entire dataset.
Input
The input consists of N lines. Each line i (1 ≤ i ≤ N) is a space-separated list of ki tokens:
- the first token is the date of the measurement, in the form YYYY-MM-DD;
- for 2 ≤ j ≤ ki, the j-th token is an integer temperature measurement tij.
Output
Print a single line with two integers: the lowest and highest temperatures in the entire dataset, in this order.
Constraints
- 1 ≤ N ≤ 1 000;
- 2 ≤ ki ≤ 100 for 1 ≤ i ≤ N;
- −50 ≤ tij ≤ 50 for 1 ≤ i ≤ N and 2 ≤ j ≤ ki.