#P1077. [NOIP 2012 普及组] 摆花
[NOIP 2012 普及组] 摆花
Description
Xiaoming’s flower shop has just opened. To attract customers, he wants to place a row of pots of flowers at the entrance. Based on a survey, he listed the most popular types of flowers, numbered from to . To showcase more types, it is required that for each type , no more than pots are used. When arranging, flowers of the same type must be placed together, and different types must be placed in increasing order of their labels.
Write a program to compute how many different arrangements there are.
Input Format
The first line contains two positive integers and , separated by a single space.
The second line contains integers, separated by single spaces, representing .
Output Format
Output a single integer, the number of arrangements. Note: since the number may be large, output the answer modulo .
2 4
3 2
2
Hint
Constraints
- For of the testdata: , , .
- For of the testdata: , , .
- For of the testdata: , , .
NOIP 2012 Junior Problem 3.
Translated by ChatGPT 5
京公网安备 11011102002149号