#P10337. [UESTCPC 2024] 操作序列

[UESTCPC 2024] 操作序列

Problem Description

You are given a sequence a1,a2,,ana_1,a_2,\ldots,a_n of length nn.

You need to choose an integer kk (1kn)(1\leq k\leq n), and then perform any number of operations on the sequence. In each operation, you can choose kk different positions in the sequence, and multiply the numbers at these positions by the same non-zero integer. In the end, make all numbers in the sequence equal.

Output the maximum kk that satisfies the requirement.

Input Format

This problem contains multiple test cases. The first line contains an integer TT (1T104)(1\leq T\leq 10^4), representing the number of test cases.

For each test case, the first line contains an integer nn (1n105)(1\leq n\leq 10^5), representing the length of the sequence.

The second line contains nn integers a1,a2,,ana_1,a_2,\ldots,a_n (1ai109)(1\leq a_i\leq 10^9), representing the given sequence.

It is guaranteed that the sum of nn over all test cases does not exceed 10610^6.

Output Format

For each test case, output one integer, representing the maximum kk that satisfies the requirement.

1
3
2 6 2
2

Hint

Translated by ChatGPT 5