#K88097. Blood Pressure Drop Analysis
Blood Pressure Drop Analysis
Blood Pressure Drop Analysis
You are given data from one or more drug trials. In each trial, there are n patients. For each patient, a sequence of blood pressure readings is provided. The first reading represents the baseline blood pressure and the subsequent readings are follow‐up measurements. The task is to compute the maximum drop in blood pressure for each patient, where the drop is defined as the difference between the initial reading and the minimum of the subsequent readings. Additionally, you must identify the patient (using 1-indexing) with the overall highest drop. In case of a tie, choose the patient who appears first in the list.
Note: All formulas are given in LaTeX format. For a patient with blood pressure readings \(a_1, a_2, \dots, a_m\), the maximum drop is computed as:
[ \text{drop} = a_1 - \min{a_2, a_3, \dots, a_m} ]
You need to process \(T\) test cases. For each test case, output the maximum drop for each patient and the patient number with the overall highest drop. The input is read from standard input (stdin) and the output should be printed to standard output (stdout).
inputFormat
The first line contains an integer \(T\) representing the number of test cases. For each test case:
- The first line contains an integer \(n\), the number of patients.
- The next \(n\) lines each contain a sequence of space-separated integers. The first integer of each line is the baseline blood pressure, followed by one or more follow-up readings.
For example:
1 3 120 115 110 130 125 120 115 140 135 130
outputFormat
For each test case, output two lines:
- The first line should contain \(n\) integers separated by spaces, representing the maximum drop for each patient.
- The second line should contain a single integer which is the 1-indexed patient number with the highest blood pressure drop.
For the sample input above, the output would be:
10 15 10 2## sample
1
1
120 115
5
1
</p>