CCCGuide

Problem S3: Good Samples

2022 · S3 · Original problem · DMOJ

Problem Description

You are composing music for the Cool Clarinet Competition (CCC). You have been instructed to make a piece of music with exactly NN notes. A note is represented as a positive integer, indicating the pitch of the note.

We call a non-empty sequence of consecutive notes in the piece a sample. For instance, (3,4,2)(3, 4, 2), (1,2,3,4,2)(1, 2, 3, 4, 2) and (4)(4) are samples of 1,2,3,4,21, 2, 3, 4, 2. Note that (1,3)(1, 3) is not a sample of 1,2,3,4,21, 2, 3, 4, 2. We call two samples different if they start or end at a different position in the piece.

We call a sample good if no two notes in the sample have the same pitch.

The clarinet players are picky in two ways. First, they will not play any note with pitch higher than MM. Second, they want a piece with exactly KK good samples.

Can you construct a piece to satisfy the clarinet players?

Input Specification

The first and only line of input will contain 33 space-separated integers, NN, MM and KK.

The following table shows how the available 15 marks are distributed.

Marks AwardedBounds on NNBounds on MMBounds on KK
3 marks1≤N≤161 \le N \le 16M=2M=21≤K≤1 0001 \leq K \leq 1\ 000
3 marks1≤N≤1061 \leq N \leq 10^6M=2M=21≤K≤10181 \leq K \leq 10^{18}
4 marks1≤N≤1061 \leq N \leq 10^6M=NM=N1≤K≤10181 \leq K \leq 10^{18}
5 marks1≤N≤1061 \leq N \leq 10^61≤M≤N1 \le M \le N1≤K≤10181 \leq K \leq 10^{18}

Output Specification

If there is a piece of music that satisfies the given constraints, output NN integers between 11 and MM, representing the pitches of the notes of the piece of music. If there is more than one such piece of music, any such piece of music may be outputted.

Otherwise, output −1-1.

Sample Input 1

3 2 5

Output for Sample Input 1

1 2 1

Explanation of Output for Sample Input 1

Notice that the piece is composed of N=3N=3 notes, each of which is one of M=2M=2 possible pitches, 1 and 2. That piece of music has a total of 6 samples, but only K=5K=5 good samples: (1)(1), (1,2)(1, 2), (2)(2), (2,1)(2, 1), (1)(1). Notice that the two good samples of (1)(1) are different since they start at two different positions.

Note that the piece 2 1 2 is the only other valid output for this input.

One example of an output that would be incorrect is 3 2 3, since it has notes with pitches larger than 2. Another incorrect output would be 1 1 2, since it only has four good samples: (1)(1), (1)(1), (2)(2) and (1,2)(1,2).

Sample Input 2

5 5 14

Output for Sample Input 2

1 5 3 2 1

Explanation of Output for Sample Input 2

The 14 good samples are: (1)(1), (1,5)(1,5), (1,5,3)(1,5,3), (1,5,3,2)(1,5,3,2), (5)(5), (5,3)(5,3), (5,3,2)(5,3,2), (5,3,2,1)(5,3,2,1), (3)(3), (3,2)(3,2), (3,2,1)(3,2,1), (2)(2), (2,1)(2,1), (1)(1).

Sample Input 3

5 5 50

Output for Sample Input 3

-1

Explanation of Output for Sample Input 3

There are no pieces with 5 notes that can produce 50 different good samples.