#include #define rep(i,a,b) for(int i=int(a);i P; int INF = (1LL << 30) - 1; int MOD = 1e9+7; template struct SparseTable { vector> st; vector lookup; SparseTable(const vector &v) { int b = 0; while ((1 << b) <= v.size()) ++b; st.assign(b, vector(1 << b)); for (int i = 0; i < v.size(); i++) { st[0][i] = v[i]; } for (int i = 1; i < b; i++) { for (int j = 0; j + (1 << i) <= (1 << b); j++) { st[i][j] = min(st[i - 1][j], st[i - 1][j + (1 << (i - 1))]); } } lookup.resize(v.size() + 1); for (int i = 2; i < lookup.size(); i++) { lookup[i] = lookup[i >> 1] + 1; } } inline T rmq(int l, int r) { int b = lookup[r - l]; return min(st[b][l], st[b][r - (1 << b)]); } }; main(){ ll N,D,K; cin >> N >> D >> K; vector X(N),v(N); rep(i, 0, N){ cin >> X[i]; } SparseTable table(X); rep(i,0,N){ if(i - D >= 0){ v[i] = table.rmq(i-D,i+1); }else{ v[i] = table.rmq(0,i+1); } } /* for(auto i:v){ cout << i << " "; }cout << endl; */ ll maxd = 0,ml,mr,l = 0,r; rep(i,0,N){ if(i - l >= D && v[i] == X[i])l = i - D + 1; if(i && v[i] == X[i] && v[i-1] != v[i])l = i; if(X[i] - v[i] > maxd){ maxd = X[i] - v[i]; ml = l; mr = i; } } if(maxd == 0) cout << 0 << endl; else cout << maxd * K << endl << ml << " " << mr << endl; }