Kth Lex Min Min Min Subpalindromes

아직 제출이 없습니다시간 제한3초메모리 제한1024 MB

문제

Consider all arrays with length nn consisting of integers from 11 to mm. Let PP 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 kk-th lexicographically minimal array with PP continuous subarrays that are palindromic. We are still only considering arrays with length nn consisting of integers from 11 to mm.

In other words, let's take all arrays with length nn consisting of integers from 11 to mm, 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 kk-th of them in this order.

입력

The only line of input contains three integers nn, mm and kk (1n1061 \le n \le 10^6, 1m1061 \le m \le 10^6, 1k10181 \le k \le 10^{18}).

출력

If there are less than kk valid arrays, print -1. Otherwise, print the kk-th lexicographically minimal of them.

힌트

Did we put min number of min in the title? Min.