#P4491. [HAOI2018] 染色
[HAOI2018] 染色
Description
To repay Xiao C for the apples, Xiao G plans to give art-loving Xiao C a canvas. This canvas can be abstracted as a sequence of length , and each position can be painted with one of colors.
However, Xiao C only cares about the number of colors that appear exactly times among the positions. If there are colors that appear exactly times, then Xiao C will gain happiness .
Xiao C wants to know, over all possible colorings, what the sum of the happiness he can obtain is, modulo .
Input Format
Read from standard input. The first line contains three integers .
The next line contains integers; the -th number denotes .
Output Format
Output to standard output. Output a single integer representing the answer.
8 8 3
3999 8477 9694 8454 3308 8961 3018 2255 4910
524070430
见 sample.zip/data2.in
见 sample.zip/data2.ans
Hint
Special property: .
Constraints: For of the testdata, , , , .

Translated by ChatGPT 5
京公网安备 11011102002149号