| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 4 초 | 1024 MB | 3 | 0 | 0 | 0.000% |
A box is divided into grids with $H$ rows and $W$ columns. Some squares contain strawberries.
The state of the box is denoted by $S,ドル and $S_{x,y} = 1$ means that the square in the $x$-th row and $y$-th column contains one strawberry. If $S_{x,y} = 0,ドル the square in the $x$-th row and $y$-th column is empty.
Tomoe devised the following method to distinguish between these strawberries.
This method could result in multiple strawberries having the same label, and the strawberries could not be distinguished. Therefore, she decided to add some strawberries before labeling them.
More formally, for $(x,y)$ such that $S_{x,y} = 0,ドル we operated $S_{x,y} \leftarrow 1$ any number of times greater than 0ドル$.
What is the minimum number of strawberries that must be added to label all the strawberries differently?
$H$ $W$
$S_{1,1}$ $S_{1,2}$ $\dots$ $S_{1,W}$
$S_{2,1}$ $S_{2,2}$ $\dots$ $S_{2,W}$
$\vdots$
$S_{H,1}$ $S_{H,2}$ $\dots$ $S_{H,W}$
Output the answer in one line. Add a new line at the end of the output.
3 2 1 0 0 1 0 1
1
4 4 0 1 1 1 1 1 1 0 1 0 1 1 1 0 1 0
2
5 5 0 0 1 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 1 0 0 0 1 0 1
8
1 1 0
0
In Sample Input 1, Tomoe can achieve the condition by placing a strawberry in the upper right square.