#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<queue>
#define ll long long
using namespace std;
const int N = 2e5 + 3;
int n , l , r , a[N];
int f[N];
deque<int> q;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> l >> r;
for(int i = 0 ; i <= n ; i++) cin >> a[i];
q.clear();
for(int i = 1 ; i <= n ; i++) f[i] = -10303303;
for(int i = l ; i <= n ; i++){
while(q.size() && f[q.front()] <= f[i - l]) q.pop_front();
while(q.size() && i - r > q.back()) q.pop_back();
q.push_front(i - l);
f[i] = f[q.back()] + a[i];
}
int ans = -103030300;
for(int i = n + 1 - r ; i <= n ; i++) ans = max(ans , f[i]);
cout << ans;
return 0;
}
代码第23行第二个while里为什么是> 而不是>=