#C1494. Maximum Elevation Finder
Maximum Elevation Finder
Maximum Elevation Finder
You are given data for t trips. Each trip provides a series of elevation measurements. For each trip, your task is to determine the maximum elevation reached.
Input Format: The first line contains an integer t, representing the number of trips. This is followed by t segments. Each segment starts with an integer n denoting the number of elevation points, followed by n space-separated integers representing the elevation measurements.
Output Format: Output a single line with t integers separated by spaces, where each integer is the maximum elevation for the corresponding trip.
Mathematical Formulation:
Given a trip with elevation measurements \(a_1, a_2, \dots, a_n\), output \(\max\{a_1, a_2, \dots, a_n\}\).
inputFormat
The input is read from stdin
and is formatted as follows:
t n1 a1,1 a1,2 ... a1,n1 n2 a2,1 a2,2 ... a2,n2 ... nt at,1 at,2 ... at,nt
Here, t is the number of trips, and for each trip, the first integer is the number of elevation points followed by the respective elevation values.
outputFormat
The output should be printed to stdout
as a single line containing t integers separated by spaces. Each integer represents the maximum elevation of the corresponding trip.
1
1 1000
1000
</p>