K-inversions#4952

K-inversions

1 sekunt
64 megabaýt
Örän ýeňil

Consider a permutation a_1, a_2, \ldots, a_n (all a_i are distinct integers from to ). We define a -inversion as a sequence of numbers i_1, i_2, \ldots, i_k such that

1 \leq i_1 < i_2 < \cdots < i_k \leq n

and

a_{i_1} > a_{i_2} > \cdots > a_{i_k}.

Your task is to determine the number of different -inversions in the given permutation.

Giriş

The first line contains two integers and (1 \leq n \leq 20000, 2 \leq k \leq 10). The second line contains integers a_1, a_2, \ldots, a_n — the permutation.

Çykyş

Output a single integer: the number of -inversions in the given permutation, modulo 10^9.

Mysallar

1-nji mysal

Loading
Loading