Logo
(追記) (追記ここまで)

28199번 - Kth Lex Min Min Min Subpalindromes 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 1024 MB377746.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

예제 출력 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.

출처

Camp > Petrozavodsk Programming Camp > Winter 2023 > Day 6: Um_nik mod 998 244 353 Contest J번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /