正文
增加 16 行删除 16 行
77 行未改动78798081828384858615 行未改动10210310410510610710810911011111212 行未改动12512612712812913013113213313413513613713813914 行未改动1541551561571581591601611627 行未改动17017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020136 行未改动23823924024124224324424524616 行未改动77 行未改动if(r == n) can = true;else ans += r - i + 1, a[r + 1] = '1', ++r;}if(can) ans = -1;printf("%lld ", ans);}return 0;}```15 行未改动}cin >> r >> c >> d;if(r * c == 2 * d) cout << C[r * c][d];else if(r * c < 2 * d) cout << 0;else cout << C[r * c][d] * 2 % mod;return 0;}```#### T3```cpp12 行未改动char c[n + 5][m + 5];memset(dis, 0x3f, sizeof dis), dis[r1][c1] = 0;memset(vis, 0, sizeof vis);queue<pair<int, int> >q; q.push({r1, c1});for(int i = 1; i <= n; ++i) scanf("%s", c[i] + 1);while(!q.empty()){int x = q.front().first, y = q.front().second, xx, yy;if(++cnt >= 80000000) break; //玄学优化if(x == r2 && y == c2){printf("%d", dis[x][y]);return 0;}14 行未改动}}printf("-1");return 0;}```#### T4```cpp7 行未改动signed main(){cin >> n >> s >> t;for(int i = 1; i <= n; ++i) scanf("%lld", &b[i]);sort(b + 1, b + 1 + n);memset(f, -0x3f, sizeof f), inf = ans = f[0][0][0];for(int i = 1; i <= n; ++i){a = b[i];res += a;f[0][0][0] = 0;for(int j = 0; j <= s; ++j)for(int p = 0; p <= t; ++p)f2[j][p] = max(f[j][p][0], f[j][p][1]);//f0/1:ai 是否已经被计算过for(int j = 0; j <= s; ++j)for(int p = 0; p <= t; ++p){if(f2[j][p] == inf) continue;if(j < s)f[min(j + a, s)][p][1] = max(f[min(j + a, s)][p][1], f2[j][p] + a);f[j][p + 1][0] = max(f[j][p + 1][0], f2[j][p] + a);}}for(int i = 0; i <= s; ++i)for(int j = 0; j <= t; ++j)ans = max(ans, max(f[i][j][0], f[i][j][1]));cout << ans;return 0;}```#### T5#### T636 行未改动f[j] = ((qs[S] - qs[j]) % mod + mod) % mod * c[j] % mod;}elsefor(int j = 0; j <= S; ++j) f[j] = c[j];}for(int i = 0; i <= S; ++i)ans = (ans + f[i]) % mod;cout << ans << '\n';}16 行未改动77 行未改动78798081828384858615 行未改动10210310410510610710810911011111212 行未改动12512612712812913013113213313413513613713813914 行未改动1541551561571581591601611627 行未改动17017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020136 行未改动23823924024124224324424524616 行未改动77 行未改动if(r == n) can = true;else ans += r - i + 1, a[r + 1] = '1', ++r;}if(can) ans = -1;printf("%lld ", ans);}return 0;}```15 行未改动}cin >> r >> c >> d;if(r * c == 2 * d) cout << C[r * c][d];else if(r * c < 2 * d) cout << 0;else cout << C[r * c][d] * 2 % mod;return 0;}```#### T3```cpp12 行未改动char c[n + 5][m + 5];memset(dis, 0x3f, sizeof dis), dis[r1][c1] = 0;memset(vis, 0, sizeof vis);queue<pair<int, int> >q; q.push({r1, c1});for(int i = 1; i <= n; ++i) scanf("%s", c[i] + 1);while(!q.empty()){int x = q.front().first, y = q.front().second, xx, yy;if(++cnt >= 80000000) break; //玄学优化if(x == r2 && y == c2){printf("%d", dis[x][y]);return 0;}14 行未改动}}printf("-1");return 0;}```#### T4```cpp7 行未改动signed main(){cin >> n >> s >> t;for(int i = 1; i <= n; ++i) scanf("%lld", &b[i]);sort(b + 1, b + 1 + n);memset(f, -0x3f, sizeof f), inf = ans = f[0][0][0];for(int i = 1; i <= n; ++i){a = b[i];res += a;f[0][0][0] = 0;for(int j = 0; j <= s; ++j)for(int p = 0; p <= t; ++p)f2[j][p] = max(f[j][p][0], f[j][p][1]);//f0/1:ai 是否已经被计算过for(int j = 0; j <= s; ++j)for(int p = 0; p <= t; ++p){if(f2[j][p] == inf) continue;if(j < s)f[min(j + a, s)][p][1] = max(f[min(j + a, s)][p][1], f2[j][p] + a);f[j][p + 1][0] = max(f[j][p + 1][0], f2[j][p] + a);}}for(int i = 0; i <= s; ++i)for(int j = 0; j <= t; ++j)ans = max(ans, max(f[i][j][0], f[i][j][1]));cout << ans;return 0;}```#### T5#### T636 行未改动f[j] = ((qs[S] - qs[j]) % mod + mod) % mod * c[j] % mod;}elsefor(int j = 0; j <= S; ++j) f[j] = c[j];}for(int i = 0; i <= S; ++i)ans = (ans + f[i]) % mod;cout << ans << '\n';}16 行未改动