这题数据是真水啊

P1725 琪露诺

sto_5k_orz @ 2023-03-13 15:34:46

#include<bits/stdc++.h>
using namespace std;
const int N = 200010; int dp[N + N], a[N + N], n, l, r;
int main() {
    scanf("%d%d%d", &n, &l, &r); for(int i = 0; i <= n; i++) scanf("%d", &a[i]);
    memset(dp, -0x3f, sizeof dp); dp[0] = 0;
    for(int i = 0; i <= n; i++) {
        for(int j = i + l; j <= i + r; j++) {
            dp[j] = max(dp[j], dp[i] + a[j]);
        }
    }
    int mx = -1e9; for(int i = n + 1; i <= n + r; i++) mx = max(mx, dp[i]); cout << mx;
    return 0;
}

这个 AC 了??


by LYS_Lewis @ 2023-03-16 13:13:55

巨啊


by I_AK_CTSC @ 2023-04-09 11:11:55

确实,一个水dp,不需要单调队列优化……


by I_AK_CTSC @ 2023-04-09 11:14:12

需不需要@管理??


by HyB_Capricornus @ 2023-04-09 11:35:28

可以构造数据把 r-l 搞得非常大


|