P28252 [洛谷] [BJWC2018] Magical Time Points
提高+
题目描述

Problem Description

One day, Little L saw three clocks, each displaying times $\texttt{01:08}$, $\texttt{03:40}$, and $\texttt{13:52}$. Little L noticed that each time on the clocks was in the format $\texttt{hh:mm}$, where $\texttt{hh}$ represents the hour and $\texttt{mm}$ represents the minutes, and none of them were on the hour (i.e., $0 \leqslant \texttt{hh} < 24$, $1 \leqslant \texttt{mm} < 60$).

Recalling the knowledge about ratios that the elementary math teacher had just taught, $\texttt{hh:mm}$ also represents a ratio, which is equal to $\frac{\texttt{hh}}{\texttt{mm}}$. Little L then discovered a magical phenomenon: adding these three time points together results in $\texttt{18:40}$, which is also a valid time not on the hour (note that the hour must be less than $24$). The corresponding ratio $\frac{9}{20}$ is equal to the sum of the ratios $\frac{1}{8}$, $\frac{3}{40}$, and $\frac{1}{4}$ of these three time points!

Now, Little L wants to know what the $k$-th smallest time point group is, when all time points that satisfy this magical property are sorted lexicographically.

Input Format

The input contains only one positive integer $k$.

Output Format

Output the $k$-th smallest time point group that satisfies the magical property described in the problem, separated by a space, as shown in the sample output. If such a group does not exist, output -1.

Sample Input and Output

Sample Input #1

65432

Sample Output #1

01:08 03:40 13:52

Sample Input #2

1

Sample Output #2

00:01 00:01 00:01

Sample Input #3

58

Sample Output #3

00:01 00:02 00:01

Sample Input #4

2000000000

Sample Output #4

-1

Notes/Hints

[Sample Explanation]

Note that the time points can be the same.

[Data Range and Constraints]

For $30\%$ of the data, $k \leqslant 1000$.
For $60\%$ of the data, $k \leqslant 20000$.
For $100\%$ of the data, $1 \leqslant k \leqslant 2 \times 10^9$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
65432
样例输出
01:08 03:40 13:52