#include using namespace std; typedef unsigned int uint; typedef long long int ll; typedef unsigned long long int ull; #define debugv(v) printf("L%d %s => ",__LINE__,#v);for(auto e:v){cout< ",__LINE__,#m);for(int x=0;x<(w);x++){cout<<(m)[x]<<" ";}cout<>= 1, k++)s = (s << 1) | (u & 1); for (; 0>= 1)cout << (s & 1); } } #define TIME chrono::system_clock::now() #define MILLISEC(t) (chrono::duration_cast(t).count()) namespace { std::chrono::system_clock::time_point t; void tic() { t = TIME; } void toc() { fprintf(stderr, "TIME : %lldms\n", MILLISEC(TIME - t)); } std::chrono::system_clock::time_point tle = TIME; void safe_tle(int msec) { assert(MILLISEC(TIME - tle) < msec); } } template ostream& operator <<(ostream &o, const pair p) { o << "(" << p.first << ":" << p.second << ")"; return o; } template> class segtree { size_t size; vector data; Compare cp; const T& selector(const T& x, const T& y) const { return cp(x, y) ? x : y; } public: segtree(size_t n) { size = 1; while (size> n >> dd >> kk; for (i = 0; i < n; ++i) { scanf("%lld", daikon + i); } segtree seg(n*2); seg.fill(BIGINT); ll best = 0; ll besti = -1, bestj; for (i = 0; i < n; ++i) { seg.update(i, i); int les = seg.query(max(0ll, i - dd), i); if (les != BIGINT && best < daikon[i] - daikon[les]) { best = daikon[i] - daikon[les]; besti = les; bestj = i; } } if (besti == -1) { cout << 0 << endl; } else { cout << (((ll)best)*(ll)kk) << endl << besti << ' ' << bestj << endl; } return 0; }