#include #include using namespace std; const auto compare = [](const auto& left, const auto& right){ if(left.first >= right.first) return left; return right; }; struct segtree{ using segclass = pair; const segclass def = make_pair(0, 0); int n = 1; vector tree; segtree(int n_){ while(n_ > (n <<= 1)); n <<= 1; tree = vector(n - 1, def); n >>= 1; } segclass get(int k){ return tree[k + n - 1]; } void update(int k, segclass a){ k += n - 1; tree[k] = a; while(k > 0){ k = (k - 1) / 2; tree[k] = compare(tree[2 * k + 1], tree[2 * k + 2]); } } segclass query(int a, int b, int k, int l, int r){ if(r <= a || b <= l) return def; if(a <= l && r <= b) return tree[k]; else{ auto vl = query(a, b, 2 * k + 1, l, (l + r) / 2); auto vr = query(a, b, 2 * k + 2, (l + r) / 2, r); return compare(vl, vr); } } }; int main(){ int n, d, k; cin >> n >> d >> k; segtree seg(n); for(int i = 0, x; i < n && cin >> x; i++) seg.update(i, make_pair(x, i)); long long num = 0; pair p; for(int i = 0; i < n; i++){ auto maxi = seg.query(i, min(n, i + d), 0, 0, n); if(num < maxi.first - seg.get(i).first){ num = maxi.first - seg.get(i).first; p = make_pair(i, maxi.second); } } cout << num * k << endl; if(!num) return 0; cout << p.first << ' ' << p.second << endl; }