#include #ifndef LOCAL_ #define fprintf if( false ) fprintf #endif // LOCAL_ #define dumpi(x1) fprintf(stderr, "#%s.%d (%s) = (%d)\n", __func__, __LINE__, #x1, x1); #define dumpii(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%d, %d)\n", __func__, __LINE__, #x1, #x2, x1, x2); #define dumpiii(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%d, %d, %d)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3); #define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1); #define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2); #define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1); #define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2); struct S002 { int n; S002& operator > (long& x) { n = x; return *this; } S002& operator >= (long& x) { if( scanf("%ld", &x) <= 0 ) exit(0); return *this; } S002& operator >= (double& x) { if( scanf("%lf", &x) <= 0 ) exit(0); return *this; } S002& operator >= (std::string& s) { if( not (std::cin >> s) ) exit(0); return *this; } template S002& operator >= (std::vector& v) { v.resize(n); for(long i = 0; i < n; ++i) { *this >= v[i]; } return *this; } }; template struct S003 { std::vector ys; S003(std::vector xs, long k) { long n = xs.size(); ys.resize(n - k + 1); std::deque q; for(long i = 0; i < n; ++i) { while( not q.empty() and xs[q.back()] >= xs[i]) q.pop_back(); q.push_back(i); long w = i - k + 1; if( w >= 0 ) { ys[w] = xs[q.front()]; if( q.front() == w ) q.pop_front(); } } } }; struct Solver { long n, d, k; std::vector xs; Solver() { S002 r; r >= n >= d >= k >n>= xs; } void solve() { std::vector ys; std::transform(xs.begin(), xs.end(), std::back_inserter(ys), [](long x){ return -x; }); S003 s(ys, d + 1); std::vector zs; for(int i = 0; i < (int)s.ys.size(); ++i) { zs.push_back((-s.ys[i]) - xs[i]); } long max = *std::max_element(zs.begin(), zs.end()); auto it = std::find(zs.begin(), zs.end(), max); long x = it - zs.begin(); auto it2 = std::find(xs.begin() + x, xs.end(), xs[x] + max); long y = it2 - xs.begin(); if( max * k == 0 ) { puts("0"); return; } printf("%ld\n", max * k); printf("%ld %ld\n", x, y); } }; int main() { for(;;) { std::unique_ptr s(new Solver()); s->solve(); } return 0; }