CCO '26 P2 - Melborp
View as PDFCanadian Computing Olympiad 2026: Day 1, Problem 2
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.
Input Specification
The first line of input will contain a single integer, . The second
line of input will contain
space-separated integers
(
).
The following table shows how the 25 available marks are distributed:
| Marks Awarded | Bounds on |
Additional Constraints |
|---|---|---|
| 2 marks | None. | |
| 3 marks | The original array | |
| 5 marks | The original array | |
| 5 marks | None. | |
| 5 marks | The original array | |
| 5 marks | None. |
Output Specification
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.
Sample Input 1
3
3 1 2
Sample Output 1
1 3 2
Explanation for Sample Output 1
The subarrays
have minimum 1. There are
such subarrays.
The subarray
has minimum 3. There is
such subarray.
The subarrays
and
have minimum 2. There are
such subarrays.
Sample Input 2
2
2 2
Sample Output 2
1 1
Sample Input 3
3
1 4 1
Sample Output 3
2 1 3
Explanation for Sample Output 3
Note that would also be accepted by the judge.
Comments