| Code Rush 2025 |
|---|
| Finished |
Dr senku Dr Senku, the scientist, has discovered a new kind of cell! They are a really interesting kind of organism that interacts with electricity in weird ways. Each cell can either be red colored or blue colored. When zapped with electricity, the cell transitions from its color to the contrary, that is, a red cell will become blue and a blue cell will become red.
Senku has set the cells in a rectangular matrix of size $$$N\times M$$$. He can zap a whole column or row of the matrix, changing the color of all its cells. He can also zap an individual cell by hand, but this takes a lot of work, so he tries to avoid it.
This morning, he got a request from his university director to make it so all cells are red by the end of the day. Since he is very lazy, he first wants to know what the minimum number of times he will have to zap an individual cell to achieve this. Help him find this number!
On the first line, numbers $$$N,M$$$ ($$$1\leq N\times M\leq760$$$). On the next $$$N$$$ lines, $$$M$$$ letters either "R" or "B" representing the cell is blue or red at the moment.
Just a number, the minimum number of times he will have to zap an individual cell.
2 2BBBB
0
2 2BRRR
1
"You get ten billion points"
| Name |
|---|


