#pragma GCC optimize("O3") #pragma GCC target("tune=native") #pragma GCC target("avx") // clang-format off #include #include #include #include #include #define FOR(i, a, b) for(int i = (a); i < (b); i++) #define RFOR(i, a, b) for(int i = (b)-1; i >= (a); i--) #define rep(i, n) for(int i = 0; i < (n); i++) #define rep1(i,n) for(int i = 1; i <= (n); i++) #define rrep(i, n) for(int i = (n)-1; i >= 0; i--) #define pb push_back #define mp make_pair #define fst first #define snd second #define show(x) cout << #x << " = " << x << endl #define chmin(x,y) x=min(x,y) #define chmax(x,y) x=max(x,y) #define pii pair #define vi vector using namespace std; template ostream& operator<<(ostream& o,const pair& p){return o<<"("< ostream& operator<<(ostream& o,const vector& vc){o<<"sz = "< b.fst){ return false; } else { if(a.snd > b.snd){ return true; } else if (a.snd < b.snd){ return false; } else { return false; } } } int main() { cin >> N >> D >> K; rep(i, N){ cin >> x[i]; } vector mask(D+1); for(int i = 0; i <= D; i++){ mask[i] = mp(x[i], i); } // [x[i-D-1],...,x[i-1]], x[i] for(int i = D+1; i < N; i++){ sort(mask.begin(), mask.end(), comp); ben[i-D-1] = mp(mask[D].fst - x[i-D-1], mask[D].snd); auto ite = lower_bound(mask.begin(), mask.end(), mp(x[i-D-1], i-D-1), comp); mask.erase(ite); mask.pb(mp(x[i], i)); } // [x[j],...,x[N-1]] // [x[N-D-1],...,x[N-1]] for(int j = N-D-1; j < N; j++){ sort(mask.begin(), mask.end(), comp); ben[j] = mp(mask.back().fst - x[j], mask.back().snd); auto ite = lower_bound(mask.begin(), mask.end(), mp(x[j], j), comp); mask.erase(ite); } int max = 0; int max_i = 0; rep(i, N){ if(max < ben[i].fst){ max = ben[i].fst; max_i = i; } } if(ben[max_i].fst == 0){ cout << 0 << endl; } else { cout << (ll)(ben[max_i].fst) * (ll)(K) << endl; cout << max_i << " " << ben[max_i].snd << endl; } return 0; }