第 045 场 AtCoder Beginner Contest
D
Snuke's Coloring
AtCoder
⌀ 1682
原题
← C→
翻译中…

Problem Statement

翻译中…

We have a grid with $H$ rows and $W$ columns. At first, all cells were painted white.

翻译中…

Snuke painted $N$ of these cells. The $i$-th ( $1 \leq i \leq N$ ) cell he painted is the cell at the $a_i$-th row and $b_i$-th column.

翻译中…

Compute the following:

翻译中…
  • For each integer $j$ ( $0 \leq j \leq 9$ ), how many subrectangles of size $3×3$ of the grid contains exactly $j$ black cells, after Snuke painted $N$ cells?
翻译中…

Constraints

翻译中…
  • $3 \leq H \leq 10^9$
  • $3 \leq W \leq 10^9$
  • $0 \leq N \leq min(10^5,H×W)$
  • $1 \leq a_i \leq H$ $(1 \leq i \leq N)$
  • $1 \leq b_i \leq W$ $(1 \leq i \leq N)$
  • $(a_i, b_i) \neq (a_j, b_j)$ $(i \neq j)$
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

H W N
a_1 b_1
:
a_N b_N

翻译中…

Output

翻译中…

Print $10$ lines. The $(j+1)$-th ( $0 \leq j \leq 9$ ) line should contain the number of the subrectangles of size $3×3$ of the grid that contains exactly $j$ black cells.

翻译中…

样例

Input #1
4 5 8
1 1
1 4
1 5
2 3
3 1
3 2
3 4
4 4
Output #1
0
0
0
2
4
0
0
0
0
0
![image](https://atcoder.jp/img/arc061/30326702be007759dce81231012a8353.png) There are six subrectangles of size $3×3$. Two of them contain three black cells each, and the remaining four contain four black cells each.
Input #2
10 10 20
1 1
1 4
1 9
2 5
3 10
4 2
4 7
5 9
6 4
6 6
6 7
7 1
7 3
7 7
8 1
8 5
8 10
9 2
10 4
10 9
Output #2
4
26
22
10
2
0
0
0
0
0
Input #3
1000000000 1000000000 0
Output #3
999999996000000004
0
0
0
0
0
0
0
0
0
题目信息
题号
arc061_b
时间限制
3 s
内存限制
256 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。