#P5594. 【XR-4】模拟赛

【XR-4】模拟赛

Description

School X is holding an in-school training camp before CSP.

There are nn OIers taking part in this training camp, and the coach has carefully prepared mm sets of mock contest problems for them.

However, each OIer has their own schedule. Coincidentally, in the next kk days, each of them happens to have exactly mm days free to do mock contests.

To make management easier, the coach requires that each person must complete the mm sets of mock contests in order.

For example, if Xiao X is free on days 2,3,52,3,5 in the next days, then they must do the 11st set on day 22, the 22nd set on day 33, and the 33rd set on day 55.

The coach needs to prepare for every person’s every mock contest. To reduce workload, if multiple people do the same set of mock contest problems on the same day, then the coach only needs to prepare one mock contest using that set of problems on that day.

As a top student in the lab, the coach wants you to help compute how many mock contests they need to prepare each day.

Input Format

The first line contains three integers n,m,kn,m,k.

In the next nn lines, each line contains mm integers. The integer ai,ja_{i,j} in row ii and column jj indicates that for the ii-th person, the jj-th free day among the next kk days is day ai,ja_{i,j}.

Output Format

Output one line with kk integers. The ii-th integer indicates the number of mock contests the coach needs to prepare on day ii among the next kk days.

1 3 5
2 3 5

0 1 1 0 1

6 3 7
2 3 4
2 5 7
3 5 7
1 3 5
5 6 7
1 2 3

1 2 3 1 3 1 1

10 10 20
2 3 4 8 9 11 12 16 17 18
2 3 6 10 12 13 14 15 19 20
1 3 7 10 11 13 14 15 17 19
1 2 4 6 7 9 15 17 19 20
2 3 5 6 9 11 14 16 19 20
1 2 3 8 9 10 11 12 15 19
1 4 6 7 9 12 13 17 18 19
1 7 8 9 10 11 13 15 18 20
1 5 6 7 8 9 13 16 18 19
4 5 7 10 11 13 14 17 18 20

1 2 2 3 2 2 4 3 3 3 3 4 2 1 3 1 2 2 2 1

Hint

This problem uses bundled tests.

  • Subtask 1 (13 points): n=m=k=1n = m = k = 1.
  • Subtask 2 (24 points): n=1n = 1.
  • Subtask 3 (24 points): m=1m = 1.
  • Subtask 4 (39 points): no special constraints.

For 100%100\% of the testdata, 1n,m,k1031 \le n,m,k \le 10^3, mkm \le k, 1ai,1<ai,2<<ai,mk1 \le a_{i,1} < a_{i,2} < \cdots < a_{i,m} \le k.

Translated by ChatGPT 5