시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 256 MB | 9 | 6 | 5 | 62.500% |
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:
Output one line with the desired permutation. If such permutation does not exist output one line with 0.
3 2
2 3 1
4 1
0