Logo
(追記) (追記ここまで)

31512번 - Matrix Fraud 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 2048 MB92302833.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:

  1. Every row has at least one 1ドル$.
  2. Every column has at least one 1ドル$.
  3. All 1ドル$s in each row are contiguous.
  4. For row $i,ドル if $s_i$ is the leftmost column that has a 1ドル$ entry and $t_i$ is the rightmost column that has a 1ドル$ entry, then it must satisfy $s_i \ge s_{i-1}$ and $t_i \ge t_{i-1}$ for $i > 1$.

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.

제한

예제 입력 1

3 4
1100
0101
0011

예제 출력 1

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번

  • 문제를 만든 사람: Arnav Sastry
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /