Choosing Elements from an array

3.8

10 votes
Problem

You are given an array of n elements . you need to tell no of different ways for choosing m elements from an array such that at most k elements should repeat.

Input Format:-

First line contains three space separated integers n,m,k Second line contains n space separated integers

Output Format:-

You need to print no of different ways for choosing m elements such that at most k elements should repeat.Print answer%1000000007

n<=100000

m<=100

k<=10

elements of array<=1000

Note: Two ways of choosing are same, when both the chosen sets are equal after sorting them.
Two ways of choosing are different when they are not same.

Author:- Kandarp Joshi

Time Limit: 2
Memory Limit: 256
Source Limit:
Editor Image

?