Problem p01223 - Generation 2

Orig Description

Problem A:Saizou
    In a certain country, a TV program called "Saizou" is popular.
    This program is about participants challenging a field athletics,
    and if they successfully clear it, they can receive a prize money.
  
    The field athletics is made by arranging blocks of different heights in a row,
    and it is important to figure out how to climb and descend the steps
    (Figure 1) in order to clear it.
    Your friend who is going to participate in this program
    has asked you, a skilled programmer, to write a program to calculate
    the maximum step to climb and the maximum step to descend
    when the structure of the field athletics is given.
  
Figure 1: An example of the structure of the athletics (the first dataset of the input example).
Input
    The first line of the input contains the number of datasets, t
    (0 < t ≤ 100).
    This is followed by t datasets.
  
    The first line of each dataset is the number of blocks that make up the field athletics, n
    (2 ≤ n ≤ 100).
    The second line shows a sequence of integers that represent the height of the blocks
    from the start to the goal.
    The first number corresponds to the starting block and the n-th number corresponds to the goal block.
    These integers are separated by a single space.
    The height h of each block satisfies 0 < h ≤ 1000.
  
Output
    For each dataset, output the maximum height difference to climb and the maximum height difference to descend,
    separated by a single space on a single line.
    If there is no step to climb or to descend, the maximum height difference for that should be 0.
  
Sample Input
5
5
10 70 30 50 90
2
20 100
2
100 30
3
50 50 50
7
123 45 678 901 234 567 890
Output for the Sample Input
60 40
80 0
0 70
0 0
633 667

Extracted Specification

An integer t (0 < t ≤ 100), representing some quantity or size.
A list of t datasets, where each dataset contains:
1. An integer n (2 ≤ n ≤ 100), representing some quantity or size.
2. A list of n integers, where each integer is between 1 and 1000.

### Example Input:

```
5
5
10 70 30 50 90
2
20 100
2
100 30
3
50 50 50
7
123 45 678 901 234 567 890
```

### Function Signature:
Write a function f(inputs) that takes in the input.
```python
def f(inputs: List[Tuple[int, List[int]]]):
    '''
    inputs: a list of tuples
    '''
```

Test Case Generator

Sure, I can help you write a test case generator for the given problem statement "Saizou". Here is a Python function to generate random test cases for this problem:

```python
import random

def tcgen():
    # Number of datasets
    t = random.randint(1, 100)
    datasets = []
    
    for _ in range(t):
        # Number of blocks in the field athletics
        n = random.randint(2, 100)
        
        # Heights of the blocks
        heights = [random.randint(1, 1000) for _ in range(n)]
        
        datasets.append((n, heights))
    
    return t, datasets

def print_test_case(t, datasets):
    # Print the number of datasets
    print(t)
    
    # Print each dataset
    for n, heights in datasets:
        print(n)
        print(" ".join(map(str, heights)))

# Example usage
t, datasets = tcgen()
print_test_case(t, datasets)
```

This script includes two functions:
1. `tcgen()` - Generates a random number of datasets `t`, and for each dataset, it generates a random number of blocks `n` and a random sequence of heights.
2. `print_test_case(t, datasets)` - Takes the generated datasets and prints them in the required format.

You can call `tcgen()` to generate random test cases and `print_test_case(t, datasets)` to print the test cases in the format specified by the problem statement. You may run this script to get the test cases for your problem.

Extract Arguments

def extract_arguments(fh):
    t = int(fh.readline().strip())
    datasets = []
    for _ in range(t):
        n = int(fh.readline().strip())
        heights = list(map(int, fh.readline().strip().split()))
        datasets.append((n, heights))
    return datasets

# if __name__ == "__main__":
#     input_path = sys.argv[1]
#     with open(input_path, 'r') as fh:
#         datasets = extract_arguments(fh)
#         for dataset in datasets:
#             n, heights = dataset
#             f(n, heights)