Problem p02110 - Generation 3

Orig Description

Problem M: Settler
Problem
  There are N vacant lots on a two-dimensional plane, and each is assigned a number from 1 to N. Since all the vacant lots are very small, they can be considered as points. The ith vacant lot exists at (xi,yi).
  Taro decided to select exactly K of these N vacant lots and build buildings on these vacant lots. However, he thought that it would not be interesting to build multiple buildings in too close proximity, so he decided to select vacant lots so that the Euclidean distance between any two vacant lots is always 2 or more.
  Create a program that outputs the combinations of vacant lots that Taro chooses. If there are multiple possible combinations, output the minimum one in lexicographic order. If, however, no matter how K vacant lots are selected, the Euclidean distance between any two vacant lots becomes less than 2, output -1 instead.
Input
Input is given in the following format:
N K
x1 y1
x2 y2
...
xN yN
Constraints
Input satisfies the following conditions:
All input is integers.
2 ≤ K ≤ N ≤ 6,000
1 ≤ xi , yi ≤ 1,000,000    ( 1 ≤ i ≤ N )
 xi mod 2 = floor ( yi ÷ 2 ) mod 2 ( 1 ≤ i ≤ N )
    (where floor ( yi ÷ 2 ) is the value obtained by dividing yi by 2 and truncating the decimal places.)
There are no multiple vacant lots at the same coordinate.
Output
Output the numbers of the vacant lots that Taro selects in ascending order, one per line.
Sample Input 1
3 2
2 1
1 2
1 3
Sample Output 1
1
3
Sample Input 2
4 3
2 1
1 2
1 3
2 4
Sample Output 2
-1
Sample Input 3
5 3
5 7
5 6
6 8
20 20
4 8
Sample Output 3
2
3
4

Extracted Specification

An integer N (2 ≤ N ≤ 6000), representing some quantity or size.
An integer K (2 ≤ K ≤ N), representing another quantity or size.
N pairs of integers (xi, yi) where each integer is between 1 and 1,000,000, representing coordinates.

### Example Input:

```
3 2
2 1
1 2
1 3
```

### Function Signature:
Write a function f(N, K, coordinates) that takes in the input.
def f(N: int, K: int, coordinates: List[Tuple[int, int]]):
    ''' 
    N: an integer 
    K: an integer
    coordinates: a list of tuples, each containing two integers
    '''

Test Case Generator

Sure, here's a test case generator for the problem "Settler":

```python
import random

def tcgen():
    # Constraints
    MIN_N = 2
    MAX_N = 6000
    MIN_K = 2
    MAX_COORD = 1000000
    
    # Randomly generate valid values for N and K
    N = random.randint(MIN_N, MAX_N)
    K = random.randint(MIN_K, N)
    
    # Generate N unique vacant lots with valid coordinates
    vacant_lots = set()
    while len(vacant_lots) < N:
        x = random.randint(1, MAX_COORD)
        y = random.randint(1, MAX_COORD)
        
        # Ensure x mod 2 = floor(y / 2) mod 2
        if x % 2 == (y // 2) % 2:
            vacant_lots.add((x, y))
    
    vacant_lots = list(vacant_lots)
    
    return N, K, vacant_lots

def main():
    N, K, vacant_lots = tcgen()
    
    print(N, K)
    for x, y in vacant_lots:
        print(x, y)
        
if __name__ == "__main__":
    main()
```

### Explanation:
1. **Generating N and K:**
   - `N` is generated randomly between 2 and 6000.
   - `K` is generated randomly between 2 and `N`.

2. **Generating Vacant Lots:**
   - A set `vacant_lots` is used to ensure uniqueness.
   - The coordinates `(x, y)` are generated with the condition `x % 2 == (y // 2) % 2`.
   - Coordinates are added to the set until it contains `N` distinct pairs.

3. **Printing Output:**
   - The values of `N` and `K` are printed.
   - Each coordinate pair `(x, y)` in `vacant_lots` is printed on a new line.

This generator ensures that all the constraints of the problem are satisfied, creating valid test cases for the "Settler" problem.

Extract Arguments

def extract_arguments(fh):
    N, K = map(int, fh.readline().strip().split())
    coordinates = []
    for _ in range(N):
        x, y = map(int, fh.readline().strip().split())
        coordinates.append((x, y))
    return N, K, coordinates