| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 2048 MB | 23 | 5 | 5 | 26.316% |
Chisato works at a traditional Japanese restaurant that just received a shipment of beautifully handcrafted chopsticks. There are $m$ different types of chopsticks, and for each type $i$ (1ドル ≤ i ≤ m$), there are exactly $k_i$ chopsticks.
Tonight, $n$ guests have arrived, and each guest needs exactly one pair of chopsticks. Since no type of chopstick has at least 2ドルn$ pieces, Chisato decides to randomly select 2ドルn$ chopsticks from the full collection, which contains $s = \sum_{i=1}^{m}{k_i}$ chopsticks in total.
After selecting the 2ドルn$ chopsticks, Chisato will try to distribute them in a way that maximizes the number of guests receiving a matching pair, that is, two chopsticks of the same type. If it’s not possible to provide matching pairs for everyone, some guests will receive mismatched pairs.
Your task is to compute the expected number of guests who receive mismatched pairs of chopsticks under this strategy.
The first line contains two integers $n$ and $m,ドル representing the number of people and the number of the chopstick type, respectively.
The second line contains $m$ integers, the $i$-th integer $k_i$ represents the number of chopstick for the $i$-th type.
Print a single integer, the expected number of people who cannot get a pair of chopsticks of the same type, multiplied by $\displaystyle\binom{s}{2n}$ (where $s = \sum_{i=1}^{m}{k_i}$). It can be proven that this product is an integer. Output the result modulo 998244353ドル$.
3 3 2 2 2
0
5 3 3 3 4
1
5 2 8 8
4032
ICPC > Regionals > Asia Pacific > Taiwan > Taiwan Online Programming Contest > TOPC 2025 H번