/* -*- coding: utf-8 -*- * * 3430.cc: No.3430 Flip the Grid - yukicoder */ #include #include using namespace std; /* constant */ const int MAX_H = 2000; const int MAX_W = 2000; /* typedef */ /* global variables */ int as[MAX_H][MAX_W]; int hs[MAX_H], vs[MAX_W]; /* subroutines */ /* main */ int main() { int h, w; scanf("%d%d", &h, &w); for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) scanf("%d", as[i] + j); for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) hs[i] += as[i][j], vs[j] += as[i][j]; int hos = 0; for (int i = 0; i < h; i++) hos += (hs[i] & 1); int vos = 0; for (int j = 0; j < w; j++) vos += (vs[j] & 1); printf("%d\n", max(hos, vos)); return 0; }