#P13633. [NWRRC 2021] First to Solve

[NWRRC 2021] First to Solve

题目描述

The famous Forcedeltas Programming Contest features nn contestants, mm problems, and lasts for kk minutes.

For each contestant ii and each problem jj, an integer ai,ja_{i, j} is known. If ai,j=0a_{i, j} = 0, it means that contestant ii can not solve problem jj. Otherwise, it means that contestant ii can solve problem jj in exactly ai,ja_{i, j} minutes.

All contestants will follow the same strategy. Specifically, each contestant will form a list of all problems they can solve, shuffle the list uniformly at random, and solve the problems in that order, until the list ends or the contest is over.

For example, if the list for contestant ii looks like j1,j2,j_1, j_2, \ldots after shuffling, then they will solve problem j1j_1 at minute ai,j1a_{i, j_1}, problem j2j_2 at minute ai,j1+ai,j2a_{i, j_1} + a_{i, j_2}, and so on. Note that no problem can be solved at minute k+1k + 1 or later.

We'll say that contestant ii gets the First to Solve\textit{First to Solve} award for problem jj if no other contestant solves problem jj strictly earlier. In particular, it means that multiple contestants can get the award for the same problem.

Find the expected number of awards each contestant will get, modulo 998244353998\,244\,353 (see the Output section for details).

输入格式

The first line contains three integers nn, mm, and kk --- the number of contestants, the number of problems, and the length of the contest in minutes (1n5001 \le n \le 500; 1m261 \le m \le 26; 1k3001 \le k \le 300).

The ii-th of the following nn lines contains mm integers ai,1,ai,2,,ai,ma_{i, 1}, a_{i, 2}, \ldots, a_{i, m} (0ai,jk0 \le a_{i, j} \le k). The jj-th of these integers denotes the number of minutes required for contestant ii to solve problem jj, or 00 if contestant ii can not solve problem jj.

输出格式

Print nn integers --- the expected number of awards contestants 1,2,,n1, 2, \ldots, n will get, modulo 998244353998\,244\,353.

Formally, let M=998244353M = 998\,244\,353. It can be shown that the expected number of awards can be expressed as an irreducible fraction pq\frac{p}{q}, where pp and qq are integers and q≢0(modM)q \not \equiv 0 \pmod{M}. Print the integer equal to pq1modMp \cdot q^{-1} \bmod M. In other words, print such an integer xx that 0x<M0 \le x < M and xqp(modM)x \cdot q \equiv p \pmod{M}.

5 3 60
30 0 0
40 20 0
30 60 0
0 0 0
60 60 1
1
1
249561089
0
499122177

提示

In the example test, contestant 11 will always get the award for problem 11, contestant 22 will always get the award for problem 22, the expected number of awards contestant 33 will get is 34\frac{3}{4}, contestant 44 will never get any awards, and the expected number of awards contestant 55 will get is 12\frac{1}{2}.