版本比较
csp-s 2024 T3所带来的启发
正文
增加 1 行删除 1 行
50 行未改动5152535455555657585911 行未改动50 行未改动 } for (LL i = 1; i<=n; i++) { dp[i] = dp[i-1]; // printf("i:%lld a[i]:%lld lst:%lld\n", i, a[i], lst[a[i]]); if (lst[a[i]]) if (lst[a[i]]) dp[i] = max(dp[i], dp[lst[a[i]]+1]+a[i]+s[i-1]-s[lst[a[i]]]); lst[a[i]] = i; } cout << dp[n] << '\n';11 行未改动