cswork / OA打开练习工作台

DeloitteOA #1

Make Grid Symmetric

估计中等可在线判题

考点(AI 标注)原地数组贪心调度

In each operation, you may flip the color of one cell. Find the minimum number of flips so that every row and every column is symmetric about its own center.

This site's standard input/output format and any supplementary ranges follow this problem's description.

输入格式

The first line contains n m (1≤n,m≤200), followed by n strings of length m containing only B/W. The upper bounds on n and m are site supplements; the original problem gives none.

输出格式

Output the minimum number of cells to flip.

样例 1

输入:

3 5
BBWWB
WWWBW
BWWWB

输出:

2

样例 2

输入:

3 3
BWB
WBB
WBW

输出:

4

样例 3

输入:

1 1
W

输出:

0