#P4304. [TJOI2013] 攻击装置
[TJOI2013] 攻击装置
Description
Given a 0-1 matrix, you can place an attack device on any cell with value 0. Each device at can attack in a knight’s move the following 8 positions: , , , , , , , . Find the maximum number of devices that can be placed so that no two devices attack each other.
Input Format
The first line contains an integer , meaning the matrix size is .
The next lines each contain a binary string of length , representing the matrix.
Output Format
Output a single integer, the maximum number of devices that can be placed so that no two devices attack each other.
3
010
000
100
4
Hint
For of the testdata, it is guaranteed that .
For of the testdata, it is guaranteed that .
Translated by ChatGPT 5
京公网安备 11011102002149号