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

17995번 - Fixed Point Permutations 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 512 MB80362140.385%

문제

A permutation of size n is a list of integers (p1, p2, ..., pn) from 1 to n such that each number appears exactly once.

The number of fixed points of a permutation is the number of indices i such that pi = i.

Given three numbers n, m, and k, find the kth lexicographically smallest permutation of size n that has exactly m fixed points (or print -1 if there are fewer than k permutations that satisfy the condition).

입력

The single line of input contains three space-separated integers

n (1 ≤ n ≤ 50) m (0 ≤ mn) k (1 ≤ k ≤ 1018)

where n is the size of the permutations, m is the number of desired fixed points, and the output should be the kth lexicographically smallest permutation of the numbers 1 to n that has exactly m fixed points.

출력

Output the desired permutation on a single line as a sequence of n space-separated integers, or output -1 if no such permutation exists.

제한

예제 입력 1

3 1 1

예제 출력 1

1 3 2

예제 입력 2

3 2 1

예제 출력 2

-1

예제 입력 3

5 3 7

예제 출력 3

2 1 3 4 5

힌트

출처

ICPC > Regionals > North America > Southeast USA Regional > 2019 Southeast USA Regional Programming Contest > Division 1 E번

ICPC > Regionals > North America > Pacific Northwest Regional > 2019 ICPC Pacific Northwest Region > Division 1 F번

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

출처

대학교 대회

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

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