Problem p00935 - Generation 1

Orig Description

Problem A
Decimal Sequences
Hanako learned the conjecture that all the non-negative integers appear in the infinite digit sequence of the decimal representation of $\pi$ = 3.14159265..., the ratio of a circle's circumference to its diameter. After that, whenever she watches a sequence of digits, she tries to count up non-negative integers whose decimal representations appear as its subsequences.
For example, given a sequence "3 0 1", she finds representations of five non-negative integers 3, 0, 1, 30 and 301 that appear as its subsequences.
Your job is to write a program that, given a finite sequence of digits, outputs the smallest non-negative integer not appearing in the sequence. In the above example, 0 and 1 appear, but 2 does not. So, 2 should be the answer.
Input
The input consists of a single test case.
$n$
$d_1$ $d_2$ ... $d_n$
$n$ is a positive integer that indicates the number of digits. Each of $d_k$'s $(k = 1, ... ,  n)$ is a digit. There is a space or a newline between $d_k$ and $d_{k+1}$ $(k = 1, ..., n - 1)$.
You can assume that $1 \leq n \leq 1000$.
Output
Print the smallest non-negative integer not appearing in the sequence.
Sample Input 1
3
3 0 1
Sample Output 1
2
Sample Input 2
11
9 8 7 6 5 4 3 2 1 1 0
Sample Output 2
12
Sample Input 3
10
9 0 8 7 6 5 4 3 2 1
Sample Output 3
10
Sample Input 4
100
3 6 7 5 3 5 6 2 9 1 2 7 0 9 3 6 0 6 2
6 1 8 7 9 2 0 2 3 7 5 9 2 2 8 9 7 3 6
1 2 9 3 1 9 4 7 8 4 5 0 3 6 1 0 6 3 2
0 6 1 5 5 4 7 6 5 6 9 3 7 4 5 2 5 4 7
4 4 3 0 7 8 6 8 8 4 3 1 4 9 2 0 6 8 9
2 6 6 4 9
Sample Output 4
11
Sample Input 5
100
7 2 7 5 4 7 4 4 5 8 1 5 7 7 0 5 6 2 0
4 3 4 1 1 0 6 1 6 6 2 1 7 9 2 4 6 9 3
6 2 8 0 5 9 7 6 3 1 4 9 1 9 1 2 6 4 2
9 7 8 3 9 5 5 2 3 3 8 4 0 6 8 2 5 5 0
6 7 1 8 5 1 4 8 1 3 7 3 3 5 3 0 6 0 6
5 3 2 2 2
Sample Output 5
86
Sample Input 6
1
3
Sample Output 6
0

Extracted Specification

An integer n (1 ≤ n ≤ 1000), representing some quantity or size.
A list of n integers d, where each integer is a digit (0 ≤ d ≤ 9).

### Example Input:

```
3
3 0 1
```

### Function Signature:
Write a function f(n, d) that takes in the input.
```python
def f(n: int, d: List[int]):
    '''
    n: an integer
    d: a list of integers
    '''
```

Test Case Generator

Sure! Here's a test case generator for the given problem statement "Decimal Sequences":

```python
import random

def tcgen():
    # Generate a random integer N within the bounds [1, 1000]
    N = random.randint(1, 1000)
    
    # Generate a sequence of N random digits (0-9)
    digits = [random.randint(0, 9) for _ in range(N)]
    
    return N, digits

def format_test_case(N, digits):
    # Helper function to format the test case as required
    formatted_digits = ' '.join(map(str, digits))
    return f"{N}\n{formatted_digits}"

# Example of generating and formatting a test case
N, digits = tcgen()
test_case = format_test_case(N, digits)
print(test_case)
```

### Explanation of the Generator:
1. **Random Integer \(N\)**: This generator creates a random integer \(N\) within the bounds [1, 1000]. This represents the number of digits in the sequence.
2. **Random Digits**: It generates a list of \(N\) random digits, each between 0 and 9.
3. **Formatting the Test Case**: The `format_test_case` function formats the generated test case into the required input format.

### Example Output:
Running the generator will produce outputs in the format required by the problem statement. Here is an example of what the output might look like:

```
100
7 2 7 5 4 7 4 4 5 8 1 5 7 7 0 5 6 2 0 4 3 4 1 1 0 6 1 6 6 2 1 7 9 2 4 6 9 3 6 2 8 0 5 9 7 6 3 1 4 9 1 9 1 2 6 4 2 9 7 8 3 9 5 5 2 3 3 8 4 0 6 8 2 5 5 0 6 7 1 8 5 1 4 8 1 3 7 3 3 5 3 0 6 0 6 5 3 2 2 2
```

This test case generator can be used to create multiple random test cases for testing your solution to the problem.

Extract Arguments

def extract_arguments(fh):
    n = int(fh.readline().strip())
    d = list(map(int, fh.read().strip().split()))
    return n, d