OpenJudge

1036:Gugle Seating

总时间限制:
1000ms
内存限制:
65536kB
描述

Gugle is one of the most powerful information technology companies. Now it has another new office whose layout looks like an N × M grids. Some cells in the grids  are occupied by chairs; some cells are occupied by computers; while others are empty.

Engineers in Gugle are all hard-working. Every one asks for two nearby computers (sharing a common edge with his chair) so he can operates both simultaneously at work. Futher more, no one can operate two computers in opposite directions at the same time, so the both computers must forms a right angle.

For eaxample, when an engineer sits at (x, y), he can't operate computers located at (x+1, y) and (x-1, y) simultaneously. Instead he may operate computers at (x-1, y) and (x, y-1).

Gugle wants to know many engineers this office can hold without moving the computers and chairs.

输入
First line: N (N ≤ 500), M (M ≤ 500)
Next N lines: M integers. 0 for empty cells, 1 for chairs and 2 for computers.
输出
The maximum engineers can be hold.
样例输入
3 4
2 2 1 2
0 1 2 2
2 2 2 1
样例输出
2
全局题号
4751
添加于
2012-05-13
提交次数
329
尝试人数
55
通过人数
35