시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB89181147.826%

문제

Virgil has just set out to study the properties of arrays. Thus, he defines a $K$-array as any array $A$ of positive integers such that all length $K$ continuous subsequences of $A$ can be partitioned into two disjoint, potentially not continuous subsequences having equal sum. For example $1$, $2$, $1$, $3$ is a $3$-array, since $1$, $2$, $1$ can be partitioned into $1$, $1$ and $2$ which both have sum $2$, and $2$, $1$, $3$ can be partitioned into $2$, $1$ and $3$ which both have sum $3$. It is not a $2$-array, since $1$, $2$ cannot be partitioned into two potentially not continuous subsequences with equal sum. Likewise it is not a $4$-array.

You are given $T$ arrays of positive integers. For each array $A$ Virgil wants to know all the values of $K$ for which $A$ is a $K$-array.

입력

The first line contains the integer $T$. The $T$ arrays follow. Each array is represented by two lines. The first line contains $N$, the length of the array. The second contains the elements of the array, separated by a single space.

출력

Output the answers for each array $A$ in order. For each array output only one line containing first the number of values of $K$ for which the given array is a $K$-array, and then those values of $K$ for which the array is a $K$-array, in increasing order.

제한

  • $1 ≤ T ≤ 20$.
  • Let $\sum{A}$ represent the sum of the values in any one array (not the sum of the values in all of the arrays). Then $1 ≤ \sum{A} ≤ 100\,000$.

서브태스크

번호배점제한
110

$1 ≤ N ≤ 30$

220

$31 ≤ N ≤ 120$

370

$121 ≤ N ≤ 1\,000$

예제 입력 1

2
7
7 3 5 1 3 3 5
6
1 2 3 5 8 3

예제 출력 1

2 4 6
2 3 6

힌트

The first array, the one of length $7$, is a $4$-array and $6$-array, since each continuous subsequence of length $4$ and $6$, respectively, can be partitioned into two potentially not continuous subsequences with equal sum.

The second array, the one of length $6$, is $3$-array and $6$-array, since each continuous subsequence of length $3$ and the of length $6$ can be partitioned into two potentially not continuous subsequences with equal sum.

채점 및 기타 정보

  • 예제는 채점하지 않는다.