#P4931. Couples Seating Arrangement
Couples Seating Arrangement
Couples Seating Arrangement
Consider (n) couples that come to a cinema which has exactly (n) rows of seats, each row containing 2 seats (i.e. a total of (2n) seats). All (2n) persons will be seated randomly so that every seat is filled. We say a couple is (\textit{harmonious}) if both members of the couple are seated in the same row. Your task is to count the number of seating arrangements in which (\textbf{exactly}) (k) couples are harmonious. Two seating arrangements are considered different if there exists at least one person who sits in different seats in the two arrangements. Since the total number of seating arrangements is ((2n)!) and the answer can be very large, output the result modulo (998244353).
(\textbf{Input Format:}) Two integers (n) and (k) are given in one line, where (1 \le n \le 10^5) (depending on test constraints) and (0 \le k \le n).
(\textbf{Output Format:}) Output a single integer: the number of seating arrangements with exactly (k) harmonious couples, modulo (998244353).
(\textbf{Explanation:}) A seating arrangement is determined by assigning each of the (2n) persons to a distinct seat. A couple is harmonious if the two persons belonging to the same couple sit in the same row. For each arrangement, count the number of rows where both seats are occupied by a couple that belongs together. You are to count those arrangements where this number is exactly (k).
inputFormat
The input consists of a single line containing two space-separated integers (n) and (k).
outputFormat
Output a single integer representing the number of seating arrangements in which exactly (k) couples are harmonious, taken modulo (998244353).
sample
1 1
2