IBMOA #17
Count Teams
Estimated MediumJudge-ready
Topics (AI-labelled)Bits & Math
From the given players choose at least minPlayers people whose skills all lie in [minLevel,maxLevel]; find the number of teams, counted as distinct index sets. No modulo is taken.
Input
The first line contains n minPlayers minLevel maxLevel, and the second line contains the skills. On this site 1≤n≤10000, 1≤minPlayers≤n, −10^9≤skills and both bounds≤10^9, and minLevel≤maxLevel.
Output
Output one integer, the answer.
Example 1
Input:
3 2 1 3
1 2 3
Output:
4
Example 2
Input:
3 1 5 5
5 5 5
Output:
7
Example 3
Input:
2 2 3 4
1 2
Output:
0
Example notes
The examples give 4, 7 and 0 respectively. Different players with the same skill count as different individuals.
Editorial
Loading solution…