PivotOJ

Bottles

시간 제한: 1000ms메모리 제한: 2048MB출처: ICPC Asia Seoul Regional 2024BOJ 32829

문제

In the famous ICPC race, nn runners will participate. The course is mm kilometers long and for safety, it is divided into mm ranges. Each range is one kilometer long and Range ii (1 ≤ i ≤ m) is the interval (i1,i)(i - 1, i), which is the section between i1i - 1 km and ii km from the starting point. We will ignore the case where the distance between the starting point and a runner is an integer. As the weather is quite hot, the organizers would like to put enough water. They will maintain a certain number of water bottles in each range. When a runner takes one bottle, they will put another immediately. They have found that the optimal number of water bottles could be obtained by calculating the maximum number of runners in that interval during the race. Based on the previous records of each runner, they have estimated how many seconds he/she will spend in each range.

Consider the following example. There are three runners, and the length of the course is six kilometers. The table shows the amount of time runners will spend in each range (in seconds).

Runner Range 11 Range 22 Range 33 Range 44 Range 55 Range 66
11 350350s 360360s 370370s 380380s 390390s 400400s
22 240240s 240240s 240240s 240240s 240240s 240240s
33 480480s 480480s 520520s 600600s 600600s 600600s

Now we will check the number of runners in each range during the race. Intentionally, the table below is not complete. When you fill the whole table and compute the maximum number of runners for each range, you can see that you need to put three bottles of water in Range 11, two in Range 22 and Range 33, and one in Range 44, Range 55, and Range 66. Note that at 480480s, Runner 22 leaves Range 22 and Runner 33 arrives at Range 22, both of which will be ignored as their distance from the starting point is an integer. At 480480s, no runner is in Range 11 and in Range 33 and Runner 11 is in Range 22. Then, for example, at 481481s, Runner 11 and Runner 33 will be in Range 22.

Time elapsed Range 11 Range 22 Range 33 Range 44 Range 55 Range 66
(00s, 240240s) 33 00 00 00 00 00
(240240s, 350350s) 22 11 00 00 00 00
(350350s, 480480s) 11 22 00 00 00 00
(480480s, 710710s) 00 22 11 00 00 00
(710710s, 720720s) 00 11 22 00 00 00
\dots \dots \dots \dots \dots \dots \dots

Given the number of runners, the length of the course, and the amount of time each runner will spend in each range, write a program to compute the number of bottles to be put in each range.

입력

Your program is to read from standard input. The input starts with a line containing two integers, nn and mm (1 ≤ n ≤ 100, 1 ≤ m ≤ 300), where nn is the number of runners and mm is the length of the course. In the following nn lines, the ii-th line contains mm positive integers that represent the amount of time Runner ii will spend in each range. More precisely, the jj-th number on the line is the time Runner ii will spend in Range jj. No runner will spend more than 1000010\,000 seconds in any range.

출력

Your program is to write to standard output. Print exactly one line. The line should contain the numbers of bottles in each range from Range 11 to Range mm.

예제

예제 1

입력
3 6
350 360 370 380 390 400
240 240 240 240 240 240
480 480 520 600 600 600
출력
3 2 2 1 1 1

예제 2

입력
4 5
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
출력
4 4 4 4 4

예제 3

입력
3 5
1 1 1 1 1
5 5 5 5 5
25 25 25 25 25
출력
3 1 1 1 1
코드를 제출하려면 로그인하세요.