#P4491. [HAOI2018] 染色

    ID: 3440 远端评测题 1000ms 500MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>2018河南各省省选O2优化容斥生成函数快速数论变换 NTT

[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 NN, and each position can be painted with one of MM colors.

However, Xiao C only cares about the number of colors that appear exactly SS times among the NN positions. If there are KK colors that appear exactly SS times, then Xiao C will gain happiness WkW_k.

Xiao C wants to know, over all possible colorings, what the sum of the happiness he can obtain is, modulo 10045358091004535809.

Input Format

Read from standard input. The first line contains three integers N,M,SN, M, S.

The next line contains M+1M + 1 integers; the ii-th number denotes Wi1W_{i-1}.

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: 1iM,Wi=0\forall 1 \le i \le M, W_i = 0.

Constraints: For 100%100\% of the testdata, 1N1071 \le N \le 10^7, 1M1051 \le M \le 10^5, 1S1501 \le S \le 150, 0Wi<10045358090 \le W_i < 1004535809.

Data

Translated by ChatGPT 5