正文
增加 4 行删除 4 行
42 行未改动4344454647484950519 行未改动61626364656667686970717273747576777879808111 行未改动42 行未改动if(!chk(x, y) || !chk(_x, _y)) return ;to[id(x, y)].push_back(id(_x, _y)), to[id(_x, _y)].push_back(id(x, y));}inline void dfs(int u, int from, bool &cir, int &siz){vis[u] = true, ++siz;for(auto v : to[u])if(v ^ from){if(!vis[v]) dfs(v, u, cir, siz);else cir |= true;9 行未改动else ++cnt[i][j], ++cnt[i - 1][j];}for(int i = 1; i <= n; ++i){scanf("%s", s + 1);for(int j = 1; j <= m + 1; ++j)if(s[j] == '0') add(i, j - 1, i, j);else ++cnt[i][j], ++cnt[i][j - 1];}for(int i = 1; i <= n; ++i)for(int j = 1; j <= m; ++j)if(!vis[id(i, j)] && cnt[i][j] < 4){dfs(id(i, j), 0, cir = 0, siz = 0);if(!cir) l[++nl] = siz;else c[++nc] = siz;}sort(l + 1, l + 1 + nl, cmp), sort(c + 1, c + 1 + nc, cmp);f[0][0] = 0;for(int i = 0; i <= nl; ++i)for(int j = (!i ? 1 : 0); j <= nc; ++j){11 行未改动42 行未改动4344454647484950519 行未改动61626364656667686970717273747576777879808111 行未改动42 行未改动if(!chk(x, y) || !chk(_x, _y)) return ;to[id(x, y)].push_back(id(_x, _y)), to[id(_x, _y)].push_back(id(x, y));}inline void dfs(int u, int from, bool &cir, int &siz){vis[u] = true, ++siz;for(auto v : to[u])if(v ^ from){if(!vis[v]) dfs(v, u, cir, siz);else cir |= true;9 行未改动else ++cnt[i][j], ++cnt[i - 1][j];}for(int i = 1; i <= n; ++i){scanf("%s", s + 1);for(int j = 1; j <= m + 1; ++j)if(s[j] == '0') add(i, j - 1, i, j);else ++cnt[i][j], ++cnt[i][j - 1];}for(int i = 1; i <= n; ++i)for(int j = 1; j <= m; ++j)if(!vis[id(i, j)] && cnt[i][j] < 4){dfs(id(i, j), 0, cir = 0, siz = 0);if(!cir) l[++nl] = siz;else c[++nc] = siz;}sort(l + 1, l + 1 + nl, cmp), sort(c + 1, c + 1 + nc, cmp);f[0][0] = 0;for(int i = 0; i <= nl; ++i)for(int j = (!i ? 1 : 0); j <= nc; ++j){11 行未改动