|
||||||||||
Ordered SubsequenceTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1049 Accepted Submission(s): 494 Problem Description A numeric sequence of ai is ordered if a1<a2<¡¡<aN. Let the subsequence of the given numeric sequence (a1, a2,¡¡, aN) be any sequence (ai1, ai2,¡¡, aiK), where 1<=i1<i2 <¡¡<iK<=N. For example, sequence (1, 7, 3, 5, 9, 4, 8) has ordered subsequences, eg. (1, 7), (3, 4, 8) and many others. Your program, when given the numeric sequence, must find the number of its ordered subsequence with exact m numbers. Input Multi test cases. Each case contain two lines. The first line contains two integers n and m, n is the length of the sequence and m represent the size of the subsequence you need to find. The second line contains the elements of sequence - n integers in the range from 0 to 987654321 each. Process to the end of file. [Technical Specification] 1<=n<=10000 1<=m<=100 Output For each case, output answer % 123456789. Sample Input
Sample Output
Source | ||||||||||
|