QOJ.ac

QOJ

Límite de tiempo: 2.0 s Límite de memoria: 1024 MB Puntuación total: 100

#14705. The Bugs

Estadísticas

一艘涂着明亮塑料柠檬黄色的潜水艇正在探测海洋深处,并测量水中塑料微粒(yoctoparticles)的浓度。由于单位选择得当,每次测量结果都是一个正整数。

该测量系统是最近才开发的,测试很不充分,极易出错。项目管理部门怀疑其中充满了 bug。他们发现自己陷入了困境。圣母玛利亚也怀疑其中充满了 bug。所有人都在呼喊:救命!

为了找出并修正这些 bug,他们聚在一起,决定获取测量浓度序列,并分析测量序列中出现的所有三元组。

  • 一个三元组(triplet)是由三个整数组成的序列。
  • 每个三元组都关联着一个特征(characteristic)。
  • 三元组 $(x, y, z)$ 的特征是一个三元组 $(\operatorname{sgn}(y - x), \operatorname{sgn}(z - y), \operatorname{sgn}(z - x))$。其中 $\operatorname{sgn}(x)$ 函数的值在 $x$ 为负数、零或正数时,分别对应为 $-1$、$0$ 或 $1$。
  • 三元组 $(x_1, y_1, z_1)$ 小于三元组 $(x_2, y_2, z_2)$,当且仅当三元组 $(x_1 - x_2, y_1 - y_2, z_1 - z_2)$ 中的第一个非零值为负数。
  • 三元组 $T$ 的标签(label)是满足以下条件中最小的三元组:其所有元素均为正整数,且其特征与 $T$ 的特征相同。

一个“被测三元组”是指作为测量序列子序列的三元组。也就是说,该三元组的元素在测量序列中出现的顺序与它们在三元组中出现的顺序相同,但在序列中它们不一定相邻。

在进行分析之前,被测三元组会根据它们的标签进行分组。管理部门希望提前知道所有被测三元组的标签集合。

输入格式

第一行包含一个整数 $N$($3 \le N \le 2 \cdot 10^5$),表示测量次数。

第二行包含 $N$ 个整数 $x_1, x_2, \dots, x_N$($1 \le x_i \le 10^9$),每个整数代表一次测量结果。

输出格式

按升序输出从给定的测量序列中可以得到的所有被测三元组的所有不同标签,每行一个。标签在输出时其连续元素之间不应有空格。

样例

输入样例 1

5
1 2 3 4 5

输出样例 1

123

输入样例 2

6
5 4 9 1 7 4

输出样例 2

121
132
211
212
213
231
312
321

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.