Orig Description
C: Matching
Problem
Given a sequence of integers $a_i$ of length $N$, output all integers $K (1 \le K \le N)$ that satisfy the following condition:
Condition:
By arranging $a_1, \cdots, a_K$ appropriately, it matches with $a_{N-K+1}, \cdots, a_N$.
Constraints
$1 \le N \le 10^5$
$1 \le a_i \le 10^9$
All inputs are integers.
Input:
$N$
$a_1 \cdots a_N$
Output:
Output all $K$ that satisfies the condition in ascending order, separated by a space. Print a newline character at the end.
Sample
Sample Input 1
8
5 2 4 9 4 9 2 5
Sample Output 1
1 2 4 6 7 8
Sample Input 2
3
5 7 5
Sample Output 2
1 2 3
Sample Input 3
9
118 118 97 116 97 97 114 110 101
Sample Output 3
9
Extracted Specification
An integer N (1 ≤ N ≤ 10^5), representing some quantity or size.
A list of integers A of size N, where each integer is between 1 and 10^9.
### Example Input:
```
8
5 2 4 9 4 9 2 5
```
### Function Signature:
Write a function f(N, A) that takes in the input.
```python
def f(N: int, A: List[int]):
'''
N: an integer
A: a list of integers
'''
```
Test Case Generator
Certainly! I'll provide a test case generator for the given problem "C: Matching".
### Problem Statement: C: Matching
**Description**
Given a sequence of integers \(a_i\) of length \(N\), output all integers \(K\) (1 ≤ \(K\) ≤ \(N\)) that satisfy the following condition:
**Condition:**
By arranging \(a_1, \cdots, a_K\) appropriately, it matches with \(a_{N-K+1}, \cdots, a_N\).
**Constraints**
- \(1 \le N \le 10^5\)
- \(1 \le a_i \le 10^9\)
**Input**
- \(N\)
- \(a_1 \cdots a_N\)
**Output**
Output all \(K\) that satisfies the condition in ascending order, separated by a space. Print a newline character at the end.
**Examples**
_Input_
```
8
5 2 4 9 4 9 2 5
```
_Output_
```
1 2 4 6 7 8
```
_Input_
```
3
5 7 5
```
_Output_
```
1 2 3
```
_Input_
```
9
118 118 97 116 97 97 114 110 101
```
_Output_
```
9
```
### Test Case Generator
Here's a Python function to generate test cases for this problem:
```python
import random
def tcgen():
# Generate N
N = random.randint(1, 10**5)
# Generate the array A of length N with elements between 1 and 10^9
A = [random.randint(1, 10**9) for _ in range(N)]
return N, A
# Example usage:
N, A = tcgen()
print(N)
print(' '.join(map(str, A)))
```
This function generates a random test case as follows:
1. The length of the array \(N\) is chosen randomly between 1 and \(10^5\).
2. Each element of the array \(A\) is chosen randomly between 1 and \(10^9\).
You can call this function to generate different test cases for the problem. The output will be printed in the required format.
Extract Arguments
def extract_arguments(fh):
N = int(fh.readline().strip())
A = list(map(int, fh.readline().strip().split()))
return N, A