Logo
(追記) (追記ここまで)

23142번 - PlayerUnknown's Battlegrounds 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1.5 초 256 MB29121150.000%

문제

When Rikka was playing PUBG (PlayerUnknown's Battlegrounds), she could not win the game. So she decided to use some techniques this time. With the techniques, now Rikka can see clearly where all players are in the game.

In the game, the map can be denoted as a grid of size $n \times m$. Rikka uses software that can rate the enemy's combat value based on their performance. Now, there is exactly one enemy in each square, and all enemies' combat values form a permutation of integers from 1ドル$ to $n \cdot m$. Since Rikka is quite a green hand, she always cares about the weakest enemies (the less the enemy's combat value is, the weaker the enemy is).

We denote the square at row $i,ドル column $j$ as $(i,j)$. A subgrid can be defined by $((x_1,y_1), (x_2,y_2)),ドル where 1ドル \le x_1 \le x_2 \le n$ and 1ドル \le y_1 \le y_2 \le m,ドル and the subgrid itself is the squares $(x, y)$ for which $x_1 \le x \le x_2$ and $y_1 \le y \le y_2$. Two subgrids $((x_1,y_1), (x_2,y_2))$ and $((x_1',y_1'), (x_2',y_2'))$ are the same if and only if $((x_1,y_1),(x_2,y_2)) = ((x_1',y_1'),(x_2',y_2'))$.

For now, Rikka wants to know how many subgrids are there such that the weakest enemy's combat value in them is equal to $x$. Help her find the answers for all $x = 1, 2, \ldots, n \cdot m$.

입력

The first line of input contains two integers $n$ and $m$ (1ドル \le n, m \le 300$).

Then follow $n$ lines. The $i$-th of them contains $m$ integers, where the $j$-th integer is the combat value of the enemy in $(i, j)$. It is guaranteed that the values form a permutation of integers from 1ドル$ to $n \cdot m$.

출력

Print $n \cdot m$ lines, with one integer on each line.

The integer on the $i$-th line is the answer for $x = i$.

제한

예제 입력 1

2 3
2 5 1
6 3 4

예제 출력 1

6
4
5
1
1
1

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2021 > Day 5: 2021 Shanghai ICPC Camp Onsite 2 by PKU E번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /