#include #define range(i,a,b) for(int i = (a); i < (b); i++) #define rep(i,b) for(int i = 0; i < (b); i++) #define all(a) (a).begin(), (a).end() #define show(x) cerr << #x << " = " << (x) << endl; #define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; const int INF = 2000000000; using namespace std; const int MAX_N = 1 << 17; //セグメントツリーを持つ配列 int n; pair dat[2 * MAX_N - 1]; void init(int n_){ n = 1; while(n < n_) n *= 2; rep(i,2 * n - 1) dat[i].first = 0; } void update(int k, int a, int b){ //葉の節点 k += n - 1; dat[k].first = a; dat[k].second = b; //登りながら更新 while(k > 0){ k = (k - 1) / 2; if(dat[k * 2 + 1].first > dat[k * 2 + 2].first){ dat[k] = dat[k * 2 + 1]; }else if(dat[k * 2 + 1].first < dat[k * 2 + 2].first){ dat[k] = dat[k * 2 + 2]; } } } //[a, b)の最小値を求める //query(a, b, 0, 0, n) pair query(int a, int b, int k, int l, int r){ //cout << a << ' ' << b << ' ' << k << ' ' << l << ' ' << r << endl; //[a, b) と[l, r)が交差しなければ、INT_MAX if(r <= a || b <= l) return make_pair(0,-1); //[a,b)が[l,r)を完全に含んでいれば、この節点の値 if(a <= l && r <= b) return dat[k]; else{ //そうでなければ、2つのこの最小値 pair vl = query(a, b, k * 2 + 1, l, ( l + r) / 2); pair vr = query(a, b, k * 2 + 2, (l + r) / 2, r); if(vl.first > vr.first) return vl; else return vr; } } int main(){ int nn, d, k; int x[100005]; cin >> nn >> d >> k; init(nn); rep(i,nn){ cin >> x[i]; update(i,x[i],i); } long long maxi = 0; pair day; rep(i,nn){ pair p; int dif; p = query(i,min(i + d + 1,n), 0, 0, n); //show(i + d) show(p.second) dif = p.first - x[i]; if(dif > maxi){ //show(i) cout << p.first << ' ' << p.second << endl; maxi = dif; day.first = i; day.second = p.second; } } cout << k * maxi << endl; if(k * maxi > 0) cout << day.first << ' ' << day.second << endl; }