Consider all arrays with length $n$ consisting of integers from $1$ to $m$. Let $P$ be the minimum number of *continuous subarrays that are palindromic* one such array can have. Recall that an array is palindromic if it is equal to its own reverse.
Find the $k$-th lexicographically minimal array with $P$ continuous subarrays that are palindromic. We are still only considering arrays with length $n$ consisting of integers from $1$ to $m$.
In other words, let’s take all arrays with length $n$ consisting of integers from $1$ to $m$, leave only those of them that have the minimum number of continuous subarrays that are palindromic, and sort them lexicographically. Your task is to find $k$-th of them in this order.
输入格式
The only line of input contains three integers $n$, $m$ and $k$ $(1\le n\le 10^6, 1\le m\le 10^6, 1\le k\le 10^{18})$.
输出格式
If there are less than $k$ valid arrays, print `-1`. Otherwise, print the $k$-th lexicographically minimal of them.
样例输入 #1
1 1 1
样例输出 #1
1
样例输入 #2
2 2 2
样例输出 #2
2 1
样例输入 #3
3 3 3
样例输出 #3
2 1 3
样例输入 #4
9 9 8244353
样例输出 #4
2 4 1 2 6 8 1 2 7
样例输入 #5
10 7 998244353
样例输出 #5
-1
样例输入 #6
3 1000 994253860
样例输出 #6
998 244 353
提示
Did we put min number of min in the title? Min.
来源
The 2023 ICPC Training Camp powered by Huawei. Day 1: Um_nik mod 998 244 353 Contest.