#P8166. [eJOI 2021] Kpart
[eJOI 2021] Kpart
Problem Description
An array containing only positive integers is called a array if every consecutive subsequence of length can be split into two parts whose element sums are equal. For example, is a array, because can be split into and with both sums equal to , and can be split into and with both sums equal to . However, this array is not a array, because cannot be split into two parts with equal element sums.
Given arrays containing only positive integers, for each array, find all possible values of such that the array is a array.
Input Format
The first line contains an integer .
Then arrays are described. For each array, the first line contains an integer , and the second line contains integers representing the elements of the array.
Output Format
Output lines. For each line, first output the number of valid values, then output all valid values in increasing order.
2
7
7 3 5 1 3 3 5
6
1 2 3 5 8 3
2 4 6
2 3 6
Hint
Constraints
This problem uses bundled testdata.
- Subtask 1 (10 pts): .
- Subtask 2 (20 pts): .
- Subtask 3 (70 pts): .
For of the testdata, , and for each array, the sum of its elements does not exceed .
Notes
This problem is translated from eJOI2021 Day 1 B Kpart.
Translated by ChatGPT 5