luogu#P2159. [SHOI2009] 舞会

    ID: 1158 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>动态规划 DP2009各省省选上海排序

[SHOI2009] 舞会

Background

Description

OItown is holding its annual super dance party.

To make this year’s party bigger than ever, the organizer Constantine invited many of his friends and classmates.

On the day of the party, exactly nn boys and nn girls came.

Constantine noticed that, in general, in a pair the boy is taller than the girl, but there are occasional exceptions.

So Constantine wants to know: if we pair these 2n2n people into exactly nn couples, how many ways are there such that at most kk couples have the girl taller than the boy?

Now Constantine asks you, who is attending SHTSC, to compute the answer.

Of course, he will first tell you the heights of all 2n2n students.

Output Format

Output a single integer in one line: the number of pairing schemes where among the nn couples, at most kk couples have the girl taller than the boy.

3 0
178
188
176
168
178
170

4

Hint

Constraints: For 100%100\% of the testdata, 1n2001 \le n \le 200, 0kn0 \le k \le n, and all heights are positive integers not greater than 10910^9.

Translated by ChatGPT 5