Problem p02060 - Generation 2

Orig Description

A: Four Tea
Problem
Tea is indispensable for programming contests. It has the effect of relieving the tension of the contestants. [citation needed]
There are N players participating in the contest, and you want to prepare tea for this number of people. There are four types of tea packages, A, B, C, and D, all of which are of the same variety but have different contents. For a package X, it is known that the price of one package is p_X yen, and it can be used to make t_X cups of tea when one is bought.
Find the minimum amount of money required to make tea for N people. Note that it is not necessary to purchase all packages, and it is not necessary to purchase packages that make exactly N cups of tea (it is sufficient if you can make more than N cups).
Input Format
The input is given in the following format.
N
p_A p_B p_C p_D
t_A t_B t_C t_D
In the first line, the number of players participating in the contest is given.
In the second line, the prices of the tea packages A, B, C, and D are given separated by spaces.
In the third line, the number of cups of tea that can be made from tea packages A, B, C, and D are given separated by spaces.
Constraints
1 \leq N \leq 100
1 \leq p_X \leq 100
1 \leq t_X \leq 100
All input values are integers.
Output Format
Print the minimum amount of money required to make tea for N people on a single line.
Sample Input 1
10
1 2 3 4
1 2 4 8
Sample Output 1
6
The optimal solution is to buy one package of B and one package of D.
Sample Input 2
5
2 9 9 8
1 4 5 100
Sample Output 2
8
It is necessary to prepare 20 times the required amount of tea, but buying one package of D is the cheapest option and it can make 5 or more cups of tea.
Sample Input 3
24
2 3 4 7
7 9 11 20
Sample Output 3
8
The optimal solution is to buy two packages of A and one package of C. It is possible that the required amount of tea cannot be made exactly, as in this case.

Extracted Specification

An integer N (1 ≤ N ≤ 100), representing some quantity or size.
A list of 4 integers P, where each integer (1 ≤ P[i] ≤ 100) represents certain values.
A list of 4 integers T, where each integer (1 ≤ T[i] ≤ 100) represents certain values.

### Example Input:

```
10
1 2 3 4
1 2 4 8
```

### Function Signature:
Write a function f(N, P, T) that takes in the input. 
def f(N: int, P: List[int], T: List[int]): 
    ''' 
    N: an integer 
    P: a list of 4 integers
    T: a list of 4 integers
    '''

Test Case Generator

Sure! Here is a test case generator for the given problem "A: Four Tea":

```python
import random

def tcgen():
    # Generate a random integer N (1 ≤ N ≤ 100)
    N = random.randint(1, 100)
    
    # Generate random prices for the tea packages (1 ≤ p_X ≤ 100)
    p_A = random.randint(1, 100)
    p_B = random.randint(1, 100)
    p_C = random.randint(1, 100)
    p_D = random.randint(1, 100)
    
    # Generate random tea cups for the tea packages (1 ≤ t_X ≤ 100)
    t_A = random.randint(1, 100)
    t_B = random.randint(1, 100)
    t_C = random.randint(1, 100)
    t_D = random.randint(1, 100)
    
    # Return the generated test case
    return N, (p_A, p_B, p_C, p_D), (t_A, t_B, t_C, t_D)

# Example of generating a test case
if __name__ == "__main__":
    N, prices, cups = tcgen()
    print(N)
    print(' '.join(map(str, prices)))
    print(' '.join(map(str, cups)))
```

This function `tcgen` will generate a random test case for the problem "A: Four Tea". It generates values for \(N\), the prices of the tea packages \(p_A, p_B, p_C, p_D\), and the number of tea cups \(t_A, t_B, t_C, t_D\) within the specified constraints. The generated test case is printed in the format required by the problem statement.

Extract Arguments

def extract_arguments(fh):
    N = int(fh.readline().strip())
    p = list(map(int, fh.readline().strip().split()))
    t = list(map(int, fh.readline().strip().split()))
    return N, p, t