| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 3 초 | 1024 MB | 37 | 7 | 7 | 46.667% |
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
2 2 2
2 1
3 3 3
2 1 3
9 9 8244353
2 4 1 2 6 8 1 2 7
10 7 998244353
-1
3 1000 994253860
998 244 353
Did we put min number of min in the title? Min.