#P10635. BZOJ3517 翻硬币
BZOJ3517 翻硬币
Problem Description
There is an chessboard, and each cell has a coin on it. is even. Each coin is either heads up or tails up. In one operation, you may choose a cell , and then flip all coins in row and all coins in column . Find the minimum number of operations needed to make all coins show the same side.
Input Format
The first line contains a positive integer . The next lines each contain a string of length , representing the states of the coins on the board.
Output Format
Only one line, the minimum number of operations needed.
4
0101
1000
0010
0101
2
Hint
Sample Explanation.
Perform operations on and , and finally all coins become .
Constraints.
For all data, .
Translated by ChatGPT 5