inlinevoidcheck(){ memset (b, 0, sizeof b); for (int i = 1; i <= n; ++ i) for (int j = 1; j <= m; ++ j) c[i][j] = a[i][j]; for (int i = 1; i <= m; ++ i) if (f[i]) work (1, i), b[1][i] = 1; for (int i = 2; i <= n; ++ i) for (int j = 1; j <= m; ++ j) if (c[i-1][j]) work (i, j), b[i][j] = 1; for (int i = 1; i <= m; ++ i) if (c[n][i]) return; intnows(0); for (int i = 1; i <= n; ++ i) for (int j = 1; j <= m; ++ j) if (b[i][j]) ++ nows; if (nows < res){ for (int i = 1; i <= n; ++ i) for (int j = 1; j <= m; ++ j) d[i][j] = b[i][j]; res = nows; } }