#P14444. [ICPC 2025 Xi'an Practice] Great Indices
[ICPC 2025 Xi'an Practice] Great Indices
题目描述
You are given a sequence . For each , index is called if and only if the following holds:
- There is at most one index such that is not a divisor of .
Your task is to find all indices in the sequence.
Recall that an integer is a divisor of an integer if and only if there exists an integer such that .
输入格式
The input consists of multiple test cases. The first line contains an integer (), the number of test cases. For each test case:
- The first line contains a single integer (), representing the length of sequence .
- The second line contains integers (), representing the given sequence.
It is guaranteed that the sum of over all test cases does not exceed .
输出格式
For each test case, output two lines:
- The first line contains a single integer , representing the number of indices.
- The second line contains integers (), representing the indices .
3
4
1 2 3 6
6
1 1 4 5 1 4
5
1 9 1 9 810
1
4
2
3 6
3
2 4 5
提示
In the first test case:
- When , the indices where is not a divisor of are , , and . Since , index is not a index.
- When , there are two indices, and , for which is not a divisor of .
- When , there are two indices, and , for which is not a divisor of .
- When , each of is a divisor of , so that index is a index.
Therefore, the only index is .