| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 (추가 시간 없음) | 2048 MB | 92 | 30 | 28 | 33.735% |
For the purposes of this problem: A matrix is a binary matrix if all its entries are 0ドル$ or 1ドル$. A matrix is a banded binary matrix if its rows and columns satisfy the following properties:
Detecting banded binary matrices is an important method used in various fields like biology, paleontology, and linguistics to unearth clusters in data sets. Unfortunately, a group called the Immoral Cartel of Pure Cozeners (ICPC) has decided to do the unthinkable: manipulate data! The ICPC wishes to present their groundbreaking scientific results, but the scientific community will not take their results seriously because their matrices may not be banded. To have publishable results, they want to toggle some cells such that their data is a banded binary matrix.
The ICPC gives you its raw data, represented as a binary matrix. They want to toggle some cells (meaning, change a 0ドル$ to a 1ドル$ or a 1ドル$ to a 0ドル$) so that the resulting matrix is a banded binary matrix, as defined above. What is the fewest number of toggles needed to turn the given matrix into a banded binary matrix?
The first line of input contains two integers $r$ and $c$ (1ドル \leq r \times c \leq 2 \cdot 10^5$), which are the dimensions of the matrix. The matrix has $r$ rows and $c$ columns.
Each of the next $r$ lines contains a string of binary digits of length $c$. This is the matrix.
Output a single integer, which is the minimum number of entries in the matrix to toggle to make the input matrix a binary banded matrix.
3 4 1100 0101 0011
1
ICPC > Regionals > North America > Pacific Northwest Regional > 2023 ICPC Pacific Northwest Region > Division 1 G번
ICPC > Regionals > North America > Mid-Central Regional > 2023 Mid-Central USA Programming Contest L번
ICPC > Regionals > North America > South Central USA Regional > 2023 South Central USA Regional Contest > Division 1 F번
ICPC > Regionals > North America > Mid-Atlantic Regional > 2023 Mid-Atlantic USA Regional Contest > Division 1 F번
ICPC > Regionals > North America > Southeast USA Regional > 2023 Southeast USA Regional Programming Contest > Division 1 F번