110 人解决,119 人已尝试。
115 份提交通过,共有 190 份提交。
2.1 EMB 奖励。
单点时限: 1.0 sec
内存限制: 256 MB
Now, little W gets a 01 matrix of size $N * M$. He wants to turn all elements in the matrix to 1. He can do the following operations:
Turning any one element to 1 from 0 costs 4.
If positions $(x1,y1), (x2,y1)$ and $(x1,y2)$ are 1, turning $(x2, y2)$ to 1 from 0 will cost 3.
He wants to know the minimum cost, please help him.
The first line contains two positive integers $N$ and $M$. $(1 \leq N, M \leq 1000)$
The following $N$ lines represent the matrix with only 0 and 1.
The answer.
2 5 10010 00001
24
6 6 010000 011010 110111 100101 110001 110100
54
110 人解决,119 人已尝试。
115 份提交通过,共有 190 份提交。
2.1 EMB 奖励。
创建: 3 年,2 月前.
修改: 3 年,2 月前.
最后提交: 7 月,1 周前.
来源: N/A