QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 2048 MB مجموع النقاط: 100

#9054. 有序问题集

الإحصائيات

你正在举办一场编程竞赛,其中包含 $n$ 道难度各不相同的题目。你希望提前宣布这些题目的排列方式满足以下条件:如果将题目分为 $1$ 到 $k$ 共 $k$ 个部分,每个部分恰好包含 $\frac{n}{k}$ 道题,且难度为 $p$ 的题目被分配到第 $\lceil \frac{kp}{n} \rceil$ 个部分,那么对于任意两个部分 $i$ 和 $j$(其中 $i < j$),第 $i$ 部分中的每一道题都比第 $j$ 部分中的每一道题简单。注意,$k$ 必须大于 $1$ 且是 $n$ 的因数。

然而,你已经将题目发送给打印机,因此题目顺序无法更改。请问对于哪些 $k$ 值,上述声明是成立的?

输入格式

第一行包含一个整数 $n$ ($2 \le n \le 50$),表示题目数量。

接下来的 $n$ 行,每行包含一个整数 $d$ ($1 \le d \le n$)。这些整数按题目在题集中出现的顺序给出了它们的难度。所有难度值互不相同。难度为 $1$ 的题目是最简单的,难度为 $n$ 的题目是最难的。

输出格式

输出一个整数列表,每行一个。这些整数是所有满足条件的 $k$ 值,按升序排列。如果不存在这样的值,输出 $-1$。

样例

输入 1

6
1
3
2
4
5
6

输出 1

2

输入 2

6
1
2
3
4
5
6

输出 2

2
3
6

输入 3

6
6
5
4
3
2
1

输出 3

-1

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.