#K51197. Plant Growth Analysis
Plant Growth Analysis
Plant Growth Analysis
Plant Growth Analysis
You are given T datasets, each containing several plant types. For each plant type, a number of plant IDs is provided. Each plant has a series of height measurements taken over a number of days. Your task is to determine, for each plant type, the plant ID exhibiting the maximum positive growth. The growth is computed using the formula \(\text{growth} = h_{last} - h_{first}\), where \(h_{first}\) and \(h_{last}\) are the first and the last recorded heights respectively.
If no plant shows a positive growth or if there are insufficient measurements (i.e. less than two), output "no growth" for that plant type. Process every dataset and output the results for each plant type in the order they appear in the input.
inputFormat
The input is read from standard input (stdin) and follows this format:
- The first line contains an integer T, denoting the number of datasets.
- Then, for each dataset:
- The first line contains two integers: d and k, where d denotes the number of days (unused) and k denotes the number of plant types.
- For each of the k plant types:
- The first line contains a string S (the plant type name) and an integer n (the number of plants for that type).
- The next n lines each contain a plant's data. Each such line begins with a plant ID (a string), followed by an integer m (the number of height measurements), and then m space-separated integers representing the measurements in order.
outputFormat
For each dataset and for each plant type within it, output a single line. If there is a plant with a positive growth, print the plant type, the plant ID with maximum growth, and the growth value separated by spaces. If no plant exhibits positive growth or if there is insufficient data, print the plant type followed by "no growth".
## sample1
2 2
rose 2
ID1 4 10 12 14 15
ID2 3 8 10 13
tulip 3
ID3 2 5 9
ID4 4 10 12 15 17
ID5 3 18 20 20
rose ID1 5
tulip ID4 7
</p>