// clang-format off #include #include #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 = "< comp = [](const pii& a, const pii& b)->bool { if(a.fst < b.fst){ return true; } else if(a.fst > 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); set mask(comp); for(int i = 0; i <= D; i++){ mask.insert(mp(x[i], 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.rbegin()->fst - x[i-D-1], mask.rbegin()->snd); auto ite = mask.lower_bound(mp(x[i-D-1], i-D-1)); mask.erase(ite); // mask.pb(mp(x[i], i)); mask.insert(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.rbegin()->fst - x[j], mask.rbegin()->snd); auto ite = mask.lower_bound(mp(x[j], j)); 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; }