#include #include #include #include #define rep(i,a,b) for(int i=(a);i<(b);i++) #define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--) #define all(x) begin(x),end(x) #define sz(x) (int)(x).size() using namespace std; using namespace atcoder; using ll=long long; using ld=long double; using vll=vector; using vvll=vector; using vi=vector; using vvi=vector; using pll=pair; using pi=pair; // using mint=modint998244353; // using BoostPoint=boost::polygon::point_data; // using Voronoi=boost::polygon::voronoi_diagram; #line 2 "data-structure/slide-window-aggregation.hpp" #include using namespace std; template struct SlideWindowAggregation { vector a0, a1, r0, r1; F f; T I, f0, f1; SlideWindowAggregation(F _f, T _i) : f(_f), I(_i), f0(_i), f1(_i) {} private: void push_s0(const T &x) { a0.push_back(x); r0.push_back(f0 = f(x, f0)); } void push_s1(const T &x) { a1.push_back(x); r1.push_back(f1 = f(f1, x)); } void transfer() { while (!a1.empty()) { push_s0(a1.back()); a1.pop_back(); } while (!r1.empty()) r1.pop_back(); f1 = I; } public: void push(const T &x) { if (a0.empty()) { push_s0(x); transfer(); } else { push_s1(x); } } void pop() { if (a0.empty()) transfer(); a0.pop_back(); r0.pop_back(); f0 = r0.empty() ? I : r0.back(); } T query() { return f(f0, f1); } }; /** * @brief Slide Window Aggrigation * @docs docs/data-structure/slide-window-aggregation.md */ int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll N,B,C; cin>>N>>B>>C; ll neg=-LONG_LONG_MAX; auto op=[](ll a,ll b){return max(a,b);}; SlideWindowAggregationwg(op,neg),wf(op,neg); wg.push(0); wf.push(0); ll f=0,g=0,P=0; rep(i,0,N){ ll a; cin>>a; P+=a; if(i>=B-1)wg.pop(); if(i>=C-1)wf.pop(); f=wg.query(); g=P+wf.query(); wg.push(g); wf.push(f-P); } cout<