Orig Description
Problem K: Chinol Choco
Problem
Chinol Choco is a chocolate company that has decided to build n new stores.
Each store manager is asked to provide two candidate locations to build a store, and the company will choose one of the locations for each store.
Chinol Choco sells m types of chocolate, each produced in a separate factory.
All stores sell all types of chocolate.
The company owns only one truck to transport chocolate, and the truck can carry chocolate for only one store at a time.
Therefore, when the truck moves from one store to another, it must visit all factories.
Find the maximum distance between two stores when the stores are arranged so that the maximum distance between two stores when moving from one store to another is minimized.
Multiple stores and factories can be located at the same location.
Input
The input is given in the following format.
n m
a0 b0 c0 d0
...
an−1 bn−1 cn−1 dn−1
x0 y0
...
xm−1 ym−1
All input is given as integers.
The first line contains two integers n and m, the number of Chinol Choco stores and the number of chocolate factories, respectively.
For each of the next n lines, two candidate coordinates (ai,bi) and (ci,di) for building the store are given, separated by a space.
The next m lines give the coordinates (xi,yi) of the factories, separated by a space.
Constraints
The input satisfies the following conditions.
2 ≤ n ≤ 200
1 ≤ m ≤ 15
0 ≤ ai,bi,ci,di,xi,yi ≤ 1000
Output
Output the maximum distance between two stores when the stores are arranged so that the maximum distance between two stores when moving from one store to another is minimized.
The output should not differ from the correct answer by more than 10−6.
Sample Input 1
2 1
0 0 5 5
3 3 6 6
2 2
Sample Output 1
4.2426406871
Sample Input 2
2 2
0 0 6 0
7 0 3 0
4 0
5 0
Sample Output 2
3.0000000000
Extracted Specification
An integer n (2 ≤ n ≤ 200) and an integer m (1 ≤ m ≤ 15), representing some quantities.
A list of n tuples, each containing four integers (0 ≤ ai, bi, ci, di ≤ 1000).
A list of m tuples, each containing two integers (0 ≤ xi, yi ≤ 1000).
### Example Input:
```
2 1
0 0 5 5
3 3 6 6
2 2
```
### Function Signature:
Write a function f(n, m, store_candidates, factories) that takes in the input.
def f(n: int, m: int, store_candidates: List[Tuple[int, int, int, int]], factories: List[Tuple[int, int]]):
'''
n: an integer
m: an integer
store_candidates: a list of tuples of four integers
factories: a list of tuples of two integers
'''
Test Case Generator
Sure, here is a test case generator for the "Problem K: Chinol Choco" problem statement:
```python
import random
def generate_coordinates(num_pairs, coord_range):
return [(random.randint(0, coord_range), random.randint(0, coord_range)) for _ in range(num_pairs)]
def tcgen():
# Number of stores (n) and number of chocolate factories (m)
n = random.randint(2, 200)
m = random.randint(1, 15)
# Generate candidate coordinates for each store
store_candidates = []
for _ in range(n):
a, b = generate_coordinates(1, 1000)[0]
c, d = generate_coordinates(1, 1000)[0]
store_candidates.append((a, b, c, d))
# Generate coordinates for each factory
factory_coordinates = generate_coordinates(m, 1000)
# Format the inputs
input_data = f"{n} {m}\n"
input_data += "\n".join(f"{a} {b} {c} {d}" for (a, b, c, d) in store_candidates) + "\n"
input_data += "\n".join(f"{x} {y}" for (x, y) in factory_coordinates) + "\n"
return input_data
# Example usage:
print(tcgen())
```
This generator creates random test cases for the problem adhering to the constraints provided. It generates:
1. The number of stores \(n\) (2 ≤ \(n\) ≤ 200).
2. The number of factories \(m\) (1 ≤ \(m\) ≤ 15).
3. The candidate coordinates \((a_i, b_i)\) and \((c_i, d_i)\) for each store \(i\) (0 ≤ \(a_i\), \(b_i\), \(c_i\), \(d_i\) ≤ 1000).
4. The coordinates \((x_i, y_i)\) for each factory \(i\) (0 ≤ \(x_i\), \(y_i\) ≤ 1000).
You can run this generator to create multiple test cases for the problem.
Extract Arguments
def extract_arguments(fh):
n, m = map(int, fh.readline().strip().split())
stores = []
for _ in range(n):
a, b, c, d = map(int, fh.readline().strip().split())
stores.append(((a, b), (c, d)))
factories = []
for _ in range(m):
x, y = map(int, fh.readline().strip().split())
factories.append((x, y))
return n, m, stores, factories