Orig Description
Score : 400 points
Problem StatementGiven is a number sequence A of length N.
Find the number of integers i \left(1 \leq i \leq N\right) with the following property:
For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i.
Constraints
All values in input are integers.
1 \leq N \leq 2 \times 10^5
1 \leq A_i \leq 10^6
InputInput is given from Standard Input in the following format:
N
A_1 A_2 \cdots A_N
OutputPrint the answer.
Sample Input 15
24 11 8 3 16
Sample Output 13
The integers with the property are 2, 3, and 4.
Sample Input 24
5 5 5 5
Sample Output 20
Note that there can be multiple equal numbers.
Sample Input 310
33 18 45 28 8 19 89 86 2 4
Sample Output 35
Extracted Specification
An integer N (1 ≤ N ≤ 2 × 10^5), representing some quantity or size.
A list of integers A of size N, where each integer is between 1 and 1e6.
### Example Input:
```
5
24 11 8 3 16
```
### Function Signature:
Write a function f(N, A) that takes in the input.
def f(N: int, A: List[int]):
'''
N: an integer
A: a list of integers
'''
Test Case Generator
Sure! Let's create a test case generator for the problem statement provided. This generator will create random test cases adhering to the given constraints.
Here is the test case generator function:
```python
import random
def tcgen():
# Generate a random integer N (1 ≤ N ≤ 2 * 10^5)
N = random.randint(1, 2 * 10**5)
# Generate a list of N integers where each integer A[i] (1 ≤ A[i] ≤ 10^6)
A = [random.randint(1, 10**6) for _ in range(N)]
return N, A
# Function to print the test case in the required format
def print_test_case():
N, A = tcgen()
print(N)
print(" ".join(map(str, A)))
# Example usage
print_test_case()
```
This function `tcgen` generates a random integer `N` within the specified range and a list of `N` integers where each integer falls within the specified range. The `print_test_case` function then formats and prints the generated test case in the required format.
You can run the `print_test_case` function to generate and print a random test case. Each call to this function will produce a new test case that adheres to the problem constraints.
Extract Arguments
def extract_arguments(fh):
N = int(fh.readline().strip())
A = list(map(int, fh.readline().strip().split()))
return N, A
# if __name__ == "__main__":
# input_path = sys.argv[1]
# with open(input_path, 'r') as fh:
# N, A = extract_arguments(fh)
# f(N, A)