玄关,100pts但附加2wa1T
查看原帖
玄关,100pts但附加2wa1T
1652521
LonelyLunar楼主2025/8/30 23:57
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
using i128 = __int128;
#define endl '\n'
#define cty cout<<"Yes"<<endl
#define ctn cout<<"No"<<endl
#define dbg(x) cout<<#x<<" : "<<x<<endl
#define int long long
const int mxn = 2e5+10;
const int mod = 998244353;
double ST,ED;
int n,l,r;
int a[mxn];
int dp[mxn];
void LonelyLunar_solve(){
	cin>>n>>l>>r;
	for(int i = 0;i <= n; i++){
		cin>>a[i];
	}
	for(int i = l;i <= n; i++){
		int tmp = 0;
		for(int j = max(0ll,i-r);j <= i-l; j++){
			tmp = max(tmp,dp[j]);
		}
		dp[i] = max(dp[i],tmp+a[i]);
	}
	int res = -1e18;
	for(int i = n-r;i <= n; i++) res = max(res,dp[i]);
	cout<<res<<endl;
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int _ = 1;
	//ST = clock();
	//cin>>_;
	while(_--){
		LonelyLunar_solve();
	}
	//ED = clock();
	//cerr<<1000*(ED-ST)/CLOCKS_PER_SEC<<"ms\n";
	return 0;
}
2025/8/30 23:57
加载中...