#P8397. [CCC 2022 S3] Good Samples
[CCC 2022 S3] Good Samples
Problem Description
Note: the notes in the score are numbers.
We define a subscore as a “non-empty contiguous sequence of notes”. That is, after sorting a sequence and removing duplicates, the difference between every two adjacent values is .
For example, , , and are subscores of .
Note that is not a subscore.
If two subscores start or end at different positions in the piece, we call them “different subscores”.
If all numbers at any two positions in a subscore are different, we call it a “good subscore”.
The performers are very picky, and they require the following for the score:
- All notes must be less than .
- There are good subscores in the score.
They now ask you whether you can construct such a score.
Input Format
The first line contains three integers . Their meanings are described in the statement.
Output Format
Output one line with integers, representing the score required by the performers.
If there are one or more valid scores, output the lexicographically smallest one. If it is impossible to construct a score that satisfies the requirements, output -1.
3 2 5
1 2 1
5 5 14
1 5 3 2 1
5 5 50
-1
Hint
For of the testdata: , , .
For another of the testdata: , , .
For another of the testdata: , , .
For of the testdata: , , .
Translated by ChatGPT 5