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

10704번 - KRATKI 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB136675346.491%

문제

All of you are probably very familiar with the problem of finding the longest monotone subsequence. You probably think you know all about it. In order to convince us, solve the problem “opposite” to finding the longest monotone subsequence.

For given N and K, find the sequence that consists of numbers from 1 to N such that each of the numbers in it appears exactly once and the length of its longest monotone subsequence (ascending or descending) is exactly K.

입력

The first line of input contains the integers N and K (1 ≤ K ≤ N ≤ 106), the length of the sequence and the required length of the longest monotone subsequence.

출력

If the required sequence doesn’t exist, output -1 in the first and only line.

If the required sequence exists, output the required sequence of N numbers in the first and only line. Separate the numbers with a single space.

The required sequence (if it exists) is not necessarily unique, so you can output any valid sequence.

제한

예제 입력 1

4 3

예제 출력 1

1 4 2 3

예제 입력 2

5 1

예제 출력 2

-1

예제 입력 3

5 5

예제 출력 3

1 2 3 4 5

힌트

Clarification of the first sample test: A sequence of length 4 with longest monotone subsequence of length 3 is (1, 4, 2, 3). The longest monotone sequence is (1, 2, 3).

출처

Contest > Croatian Open Competition in Informatics > COCI 2014/2015 > Contest #6 4번

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

출처

대학교 대회

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

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