#K47527. The Cleanest Plate Problem
The Cleanest Plate Problem
The Cleanest Plate Problem
In this problem, you are given multiple test cases. Each test case consists of several stacks of plates. For each stack, the first integer indicates the number of plates in that stack, followed by the cleanliness levels for each plate. Your task is to determine the cleanest plate in each test case, where the cleanest plate is defined as the one with the highest cleanliness level.
Mathematically, for each test case with stacks (S_1, S_2, \dots, S_k), where each stack (S_i) has plates with cleanliness levels (a_{i1}, a_{i2}, \dots, a_{in_i}), you are to compute:
[ \max {\max_{1 \leq j \leq n_i} a_{ij} : 1 \leq i \leq k} ]
and output the result on a new line for each test case. The input is provided via standard input and the output should be printed to standard output.
inputFormat
The input begins with a single integer \(T\) representing the number of test cases. Each test case starts with an integer \(S\) representing the number of stacks. This is followed by \(S\) lines where each line describes a stack. In each such line, the first integer indicates the number of plates in the stack and is followed by that many integers that represent the cleanliness levels.
Example:
1 3 3 5 1 9 2 3 8 4 7 6 2 4
This represents 1 test case with 3 stacks. The first stack has 3 plates with cleanliness levels 5, 1, and 9, and so on.
outputFormat
For each test case output a single integer on a new line — the cleanliness level of the cleanest (i.e. the plate having the highest cleanliness level) plate across all stacks in that test case.
Example Output:
9## sample
1
3
3 5 1 9
2 3 8
4 7 6 2 4
9
</p>