#C5234. Maximum Values in Sublists
Maximum Values in Sublists
Maximum Values in Sublists
You are given an integer T representing the number of sublists. Following this, there are T lines. Each line starts with an integer m which denotes the number of elements in that sublist, followed by m space‐separated integers. Your task is to compute the maximum value for each non-empty sublist, and output these maximum values in the order of their appearance. If a sublist is empty (i.e. m = 0), it is skipped and no output is produced for that sublist.
Input Format:
- The first line contains an integer T denoting the number of sublists.
- Each of the following T lines begins with an integer m, the number of elements in the sublist, followed by m integers.
Output Format:
A single line containing the maximum values of each non-empty sublist separated by a single space. If there is no non-empty sublist, output nothing.
Note: All formulas are represented in LaTeX format. For instance, the number of sublists is given by $T$, and an empty sublist is defined as one for which $m=0$.
inputFormat
The input is read from stdin with the following format:
T m1 a1 a2 ... am1 m2 b1 b2 ... bm2 ...
Where the first line contains an integer $T$, and each subsequent line represents a sublist: the first integer on the line is the length $m$ of that sublist, followed by $m$ space-separated integers.
outputFormat
Output the maximum value of each non-empty sublist on a single line to stdout, separated by spaces. If all sublists are empty, output nothing.
## sample5
3 1 3 5
3 4 6 2
0
3 -1 -5 -3
3 10 15 5
5 6 -1 15