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

15441번 - Vera and Mean Sorting 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB38151145.833%

문제

The harmonic mean of a sequence of positive integers x1, · · · , xN is

\[H\left(x_1, \cdots, x_N\right) = \left( \frac{\sum_{i=1}^{N}{x_i^{-1}}}{N}\right)^{-1} \text{.}\]

Vera classifies an array of positive integers A = [A1, · · · , AN] of length N as K-mean-sorted if M(i) ≥ M(i + 1) for 1 ≤ i ≤ N − K where

\[M\left(i\right) = H\left(A_i, \cdots, A_{i+K-1}\right) \text{.}\]

A permutation P is an ordered set of integers P1, P2, · · · , PN , consisting of N distinct positive integers, each of which are at most N.

Permutation P is lexicographically smaller than permutation Q if there is an i (1 ≤ i ≤ N), such that Pi < Qi, and for any j (1 ≤ j < i) Pj = Qj.

Given integers N and K, help Vera find the lexicographically smallest permutation P of integers 1 to N such that P is K-mean-sorted but not L-mean-sorted for 1 ≤ L ≤ N − 1, L ≠ K.

If no such permutation exists output 0.

입력

The input will be in the format:

N K

Constraints:

  • 2 ≤ N ≤ 100
  • 1 ≤ K ≤ N − 1
  • N, K are integers

출력

Output one line with the desired permutation. If such permutation does not exist output one line with 0.

제한

예제 입력 1

3 2

예제 출력 1

2 3 1

예제 입력 2

4 1

예제 출력 2

0

힌트

출처

Contest > Waterloo's local Programming Contests > 4 March, 2017 C번

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

출처

대학교 대회

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

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