QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 2048 MB Puntuación total: 100

#8097. Kpart

Estadísticas

Virgil 刚刚开始研究数组的性质。因此,他将 $K$-数组定义为任何由正整数组成的数组 $A$,使得 $A$ 中所有长度为 $K$ 的连续子序列都可以被划分为两个不相交的、可能不连续的子序列,且这两个子序列的和相等。例如,$1, 2, 1, 3$ 是一个 $3$-数组,因为 $1, 2, 1$ 可以划分为和均为 $2$ 的 $\{1, 1\}$ 和 $\{2\}$,而 $2, 1, 3$ 可以划分为和均为 $3$ 的 $\{2, 1\}$ 和 $\{3\}$。它不是一个 $2$-数组,因为 $1, 2$ 无法划分为两个和相等的子序列。同样,它也不是一个 $4$-数组。

给定 $T$ 个正整数数组。对于每个数组 $A$,Virgil 想知道所有使 $A$ 成为 $K$-数组的 $K$ 值。

输入格式

第一行包含整数 $T$。接下来是 $T$ 个数组。每个数组由两行表示:第一行包含数组长度 $N$,第二行包含数组元素,以空格分隔。

输出格式

按顺序输出每个数组 $A$ 的答案。对于每个数组,仅输出一行,首先包含使给定数组成为 $K$-数组的 $K$ 的个数,然后按升序输出这些 $K$ 值。

数据范围

  • $1 \le T \le 20$。
  • 设 $\sum A$ 表示任一数组中所有元素的和,则 $1 \le \sum A \le 100\,000$。
# 分值 数据范围
1 10 $1 \le N \le 30$
2 20 $31 \le N \le 120$
3 70 $121 \le N \le 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

说明

第一个长度为 $7$ 的数组是 $4$-数组和 $6$-数组,因为长度分别为 $4$ 和 $6$ 的每个连续子序列都可以被划分为两个和相等的子序列。

第二个长度为 $6$ 的数组是 $3$-数组和 $6$-数组,因为长度分别为 $3$ 和 $6$ 的每个连续子序列都可以被划分为两个和相等的子序列。

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
EditorialOpen Official EditorialQingyu- Download

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.