#include #include #include #include #include template struct SlidingWindow { using Cmp = std::function; std::deque> window; Cmp cmp; int l, r; explicit SlidingWindow(Cmp cmp) : window(), cmp(cmp), l(0), r(0) {} void push(T val) { while (!window.empty() && cmp(val, window.back().first)) { window.pop_back(); } window.emplace_back(val, r++); } std::pair get() { return window.front(); } void pop() { if (window.front().second == l++) { window.pop_front(); } } }; using lint = long long; void solve() { int n, d, k; std::cin >> n >> d >> k; SlidingWindow sw([](auto a, auto b) { return a < b; }); int max = 0, l = -1, r = -1; for (int i = 0; i < n; ++i) { int x; std::cin >> x; sw.push(x); auto [y, j] = sw.get(); if (x - y > max) { max = x - y; l = j, r = i; } if (i >= d) sw.pop(); } if (max <= 0) { std::cout << "0\n"; } else { std::cout << lint(max) * k << "\n" << l << " " << r << "\n"; } } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }