logo AlgoBeat OnlineJudge
登录 注册

#216900. [CCO 2026] Melborp

内存限制:512 MiB 时间限制:3000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Seta is creating problems for the CCO! She came up with the following problem:

Given an array whose values are in the range , define to be the number of pairs such that and .

Print the array .

However, the day before the CCO, Seta’s computer crashed, and she was only able to recover the output files. Given the output array , can you write a program to reconstruct the input array ?

Seta reminds you that the array is not necessarily unique, and she will accept any valid array.

输入格式

The first line of input will contain a single integer, . The second line of input will contain space-separated integers ().

输出格式

Output space-separated integers, the array , where . It is guaranteed that there will always exist at least one valid array .

If there is more than one valid array, you may output any valid array. In particular, even if the original array is a permutation, your answer does not have to be a permutation.

样例

样例输入 1

3
3 1 2

样例输出 1

1 3 2

样例输入 2

2
2 2

样例输出 2

1 1

样例输入 3

3
1 4 1

样例输出 3

2 1 3

数据范围与提示

Explanation of Output for Sample Input

  • The subarrays , , have minimum . There are such subarrays.
  • The subarray has minimum . There is such subarray.
  • The subarrays and have minimum . There are such subarrays.

Explanation of Output for Sample Input

Note that would also be accepted by the judge.

The following table shows how the available marks are distributed:

Marks Awarded Bounds on Additional Constraints
marks None.
marks The original array is a permutation.
marks
^ None.
The original array is a permutation.
^ None.