Orig Description
B: Periodic Sequence
Problem
Dr. Period, who serves as a professor at H University, researches the property called the "period" that is said to lurk in everything. As a basic period generally known, a period lurking in a sequence could be considered. That is, if the length N sequence S = S_1, S_2, ... , S_N satisfies the following property, it is a fact that it has a period t (t \≤ N).
For 1 \≤ i \≤ N − t, S_i=S_{i+t}.
Now, Dr. Period is focusing on sequences that can be described more simply using periods. For example, if a length N sequence has a period t (\≤ N), and it can be written as N=kt using an integer k, the sequence can be described as a length t sequence S_1, ... , S_t that is a concatenation of k continuous ones. Dr. Period has decided to call such a sequence a k-part.
Dr. Period is interested in the largest k-part. Therefore, you, as an assistant, have been asked to create a program that takes a sequence as input and outputs the largest k when it is a k-part. Create a program that accurately responds to Dr. Period's request.
Input Format
N
S_1 ... S_N
The first line contains an integer N, which represents the length of the sequence. The second line contains integers S_i (1 \≤ i \≤ N) that represent each element of the length N sequence, separated by spaces. The input satisfies 1 \≤ N \≤ 200,000 and 1 \≤ S_i \≤ 100,000 (1 \≤ i \≤ N).
Output Format
For the given sequence, output the maximum value of k when it is a k-part on one line.
Sample Input 1
6
1 2 3 1 2 3
Sample Output 1
2
Sample Input 2
12
1 2 1 2 1 2 1 2 1 2 1 2
Sample Output 2
6
Sample Input 3
6
1 2 3 4 5 6
Sample Output 3
1
Extracted Specification
An integer N (1 ≤ N ≤ 200,000), representing some quantity or size.
A list of integers S of size N, where each integer is between 1 and 100,000.
### Example Input:
```
6
1 2 3 1 2 3
```
### Function Signature:
Write a function f(N, S) that takes in the input.
def f(N: int, S: List[int]):
'''
N: an integer
S: a list of integers
'''
Test Case Generator
Sure, I can help you write a test case generator for the given problem statement "B: Periodic Sequence". Below is the Python function to generate random test cases that adhere to the given constraints.
```python
import random
def tcgen():
# Generate a random integer N within the constraint 1 ≤ N ≤ 200,000
N = random.randint(1, 200000)
# Generate a list S of N integers, each within the constraint 1 ≤ S_i ≤ 100,000
S = [random.randint(1, 100000) for _ in range(N)]
return N, S
# Example usage:
if __name__ == "__main__":
N, S = tcgen()
print(N)
print(" ".join(map(str, S)))
```
### Explanation:
1. **N Generation**: We randomly generate \( N \) between 1 and 200,000.
2. **S Generation**: We generate a list \( S \) of size \( N \), where each element is a random integer between 1 and 100,000.
You can run this script to generate random test cases for the problem. The `tcgen` function will return a tuple with \( N \) and the sequence \( S \), which you can then format as needed for input.
### Example Output:
Running the script might give you an output like:
```
547
34567 12345 67890 23456 98765 12345 ... (up to 547 numbers)
```
This setup ensures that your test cases are diverse and cover the range of possible inputs as specified in the problem constraints.
Extract Arguments
def extract_arguments(fh):
N = int(fh.readline().strip())
S = list(map(int, fh.readline().strip().split()))
return N, S