Problem p00146 - Generation 2

Orig Description

Lupin III
Lupin III, a famous thief, hears from a beautiful woman named Fujimineko, who is a descendant of an Aizu clan samurai, that the Aizu clan left behind military funds in Aizu-Wakamatsu City. According to the report of Ishikawa Goemon, Lupin's long-time companion, the military funds are stored in several warehouses in wooden boxes. The warehouses are not guarded, but they are locked securely. However, if Goemon uses the secret technique "Steel Cutting" that he learned from his father, he can break open the warehouses in an instant.
The remaining problem is the transportation of the wooden boxes. Lupin and Goemon, who lack physical strength, cannot carry even one wooden box. Therefore, they rely on a dependable man named Mugen Daisuke for transportation.
To transport all the wooden boxes, Lupin devises the following plan:
First, Lupin will drive to the first warehouse and drop off Goemon and Daisuke.
Goemon breaks open the warehouse.
Daisuke carries all the wooden boxes.
Lupin heads to the next warehouse with the wooden boxes.
This is repeated until all the warehouses are broken open and the wooden boxes are transported. During this time, Lupin prepares a helicopter and carries Goemon, Daisuke, and the wooden boxes to the last warehouse, then escapes. Daisuke can carry anything, no matter how heavy, but his speed decreases depending on the weight of the luggage. Lupin must determine the order in which to break open the warehouses, taking this into account.
On behalf of Lupin, write a program that outputs the order in which to break open the warehouses so that the time from breaking open the first warehouse to reaching the last warehouse is minimized. However,
The warehouses all face a street that runs straight north from Tsuruga Castle. There are at most 15 warehouses, and they are all within 10,000 meters of the castle.
Each wooden box weighs 20 kilograms. There are at most 10,000 wooden boxes stored in each warehouse.
Transportation from warehouse to warehouse is done through an underground passage that runs along the street.
Daisuke moves at a rate of 2,000 / (70 + w) meters per minute when carrying a load of w kilograms.
For each warehouse, the input consists of the warehouse number (an integer up to 100), the distance from the castle in meters (an integer between 1 and 10,000), and the number of wooden boxes stored in the warehouse (an integer between 1 and 10,000).
Input
The input is given in the following format.
n
s1 d1 v1
s2 d2 v2
:
sn dn vn
The first line contains the number of warehouses, n (n ≤ 15), and the following n lines describe the warehouses. Each line gives the warehouse number si (1 ≤ si ≤ 100), the distance from the castle di (1 ≤ di ≤ 10,000), and the number of wooden boxes stored in the warehouse vi (1 ≤ vi ≤ 10,000).
Output
Output the order in which to break open the warehouses on a single line, separated by spaces.
Sample Input 1
2
1 100 1
2 200 2
Output for the Sample Input 1
1 2
Sample Input 2
3
11 100 1
13 200 20
12 300 3
Output for the Sample Input 2
11 12 13
Sample Input 3
5
13 199 1
51 1000 1
37 350 10
27 300 2
99 200 1000
Output for the Sample Input 3
51 37 27 13 99

Extracted Specification

An integer n (n ≤ 15), representing some quantity or size.
A list of n tuples, each containing:
- An integer si (1 ≤ si ≤ 100)
- An integer di (1 ≤ di ≤ 10,000)
- An integer vi (1 ≤ vi ≤ 10,000)

### Example Input:
```
3
11 100 1
13 200 20
12 300 3
```

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

Test Case Generator

Certainly! Below is a Python function that generates random test cases for the "Lupin III" problem:

```python
import random

def tcgen():
    # Number of warehouses (1 ≤ n ≤ 15)
    n = random.randint(1, 15)
    
    # Generate warehouse details
    warehouses = []
    for _ in range(n):
        # Warehouse number (1 ≤ si ≤ 100)
        s = random.randint(1, 100)
        # Distance from the castle (1 ≤ di ≤ 10,000)
        d = random.randint(1, 10000)
        # Number of wooden boxes (1 ≤ vi ≤ 10,000)
        v = random.randint(1, 10000)
        warehouses.append((s, d, v))
    
    return n, warehouses

# Function to format the test case for output
def format_test_case(n, warehouses):
    result = f"{n}\n"
    for s, d, v in warehouses:
        result += f"{s} {d} {v}\n"
    return result.strip()

# Generate and format a test case
n, warehouses = tcgen()
test_case = format_test_case(n, warehouses)
print(test_case)
```

The `tcgen` function generates a random number of warehouses and then, for each warehouse, it generates random values for the warehouse number, distance from the castle, and number of wooden boxes. The `format_test_case` function formats this data into the required input format for the problem statement. The generated test case is printed at the end.

You can run this code multiple times to get different test cases for the "Lupin III" problem.

Extract Arguments

def extract_arguments(fh):
    n = int(fh.readline().strip())
    warehouses = []
    for _ in range(n):
        s, d, v = map(int, fh.readline().strip().split())
        warehouses.append((s, d, v))
    return n, warehouses

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