DivMEXAI (CI翻译)
You are given an array $a_1, a_2, \ldots, a_n$ of positive integers.
你将得到一个由正整数组成的数组 $a_1, a_2, \ldots, a_n$。AI (CI翻译)
Let $f(l,r)$ for $1 \leq l \leq r \leq n$ be the smallest positive integer that doesn't divide $\operatorname{lcm}(a_l, a_{l+1}, \ldots, a_r)$. Here, $\operatorname{lcm}$ of an array of integers denotes the least common multiple (LCM) of these integers.
对于满足 $1 \leq l \leq r \leq n$ 的每一对 $(l,r)$,令 $f(l,r)$ 为不能整除 $\operatorname{lcm}(a_l, a_{l+1}, \ldots, a_r)$ 的最小正整数。其中,整数数组的 $\operatorname{lcm}$ 表示这些整数的最小公倍数(LCM)。AI (CI翻译)
Determine every positive integer $x$ such that there exists a pair of integers $(l,r)$ such that $1 \leq l \leq r \leq n$ and $f(l,r) = x$.
确定所有满足以下条件的正整数 $x$:存在一对整数 $(l,r)$,使得 $1 \leq l \leq r \leq n$ 且 $f(l,r) = x$。AI (CI翻译)
Input
输入格式
AI (CI翻译)Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.
每个测试文件包含多组测试用例。第一行包含测试用例的数量 $t$($1 \le t \le 10^4$)。接下来是各组测试用例的描述。AI (CI翻译)
The first line of each test case contains $n$ ($1 \le n \le 2 \cdot 10^5$), denoting the size of the array.
每组测试用例的第一行包含一个整数 $n$($1 \le n \le 2 \cdot 10^5$),表示数组的长度。AI (CI翻译)
The second line of each test case contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le n$).
每组测试用例的第二行包含 $n$ 个整数 $a_1, a_2, \ldots, a_n$($1 \leq a_i \leq n$)。AI (CI翻译)
It is guaranteed that the sum of $n$ over all test cases does not exceed $2 \cdot 10^5$.
保证所有测试用例的 $n$ 之和不超过 $2 \cdot 10^5$。AI (CI翻译)
Output
输出格式
AI (CI翻译)For each test case, output two lines.
对于每组测试用例,输出两行。AI (CI翻译)
The first line should contain a single integer $k$ — the number of suitable integers $x$.
第一行应包含一个整数 $k$——符合条件的整数 $x$ 的数量。AI (CI翻译)
The second line should contain $k$ integers $x_1 \lt x_2 \lt \ldots \lt x_k$, the suitable integers in increasing order.
第二行应包含 $k$ 个整数 $x_1 \lt x_2 \lt \ldots \lt x_k$,即按递增顺序排列的所有符合条件的整数。AI (CI翻译)
Note
说明
AI (CI翻译)In the first test case, the only $(l,r)$ pair is $(1,1)$, and $f(1,1) = 2$.
在第一组测试用例中,唯一的 $(l,r)$ 对是 $(1,1)$,且 $f(1,1) = 2$。AI (CI翻译)
In the second test case, $(l,r)=(1,1)$ yields the set of divisors $\{ 1,2 \}$, $(l,r)=(1,2)$ yields the set of divisors $\{ 1, 2, 3, 6\}$, and $(l,r)=(2,2)$ yields the set of divisors $\{ 1, 3 \}$. This means $f(1,1)=3$, $f(1,2)=4$, and $f(2,2)=2$. Since no other $(l,r)$ pair produces a different $f$ value, the answer is $[2,3,4]$.
在第二组测试用例中,$(l,r)=(1,1)$ 得到的因数集合为 $\{ 1,2 \}$,$(l,r)=(1,2)$ 得到的因数集合为 $\{ 1, 2, 3, 6\}$,而 $(l,r)=(2,2)$ 得到的因数集合为 $\{ 1, 3 \}$。这意味着 $f(1,1)=3$、$f(1,2)=4$ 且 $f(2,2)=2$。由于没有其他 $(l,r)$ 对能够产生不同的 $f$ 值,答案为 $[2,3,4]$。AI (CI翻译)
For the last test case, $f(2,2)=2$, $f(1,1)=3$, and $f(1,5)=5$. It can be seen that no other values can be obtained.
对于最后一组测试用例,$f(2,2)=2$、$f(1,1)=3$ 且 $f(1,5)=5$。可以看出,无法得到其他值。AI (CI翻译)
样例
3
1
1
3
2 3 1
5
4 3 1 3 4
1
2
3
2 3 4
3
2 3 5
题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。