#include typedef long long ll; using namespace std; typedef pair p; int INF = 1e9; int MOD = 1e9+7; main(){ ll N,D,K,X[100000]; cin >> N >> D >> K; for(int i = 0;i < N;i++)cin >> X[i]; int minn = INF,maxn = 0,maxd = 0,mini,maxi; priority_queue

bq;//降順 priority_queue,greater

> sq;//昇順 for(int i = 0;i <= D;i++){ bq.push(p(X[i],i)); sq.push(p(X[i],i)); /* if(minn > X[i]){ minn = X[i]; mini = i; } if(maxn < X[i]){ maxn = X[i]; maxi = i; } maxd = max(maxd,maxn-minn); */ while(bq.top().second < sq.top().second){ sq.pop(); } if(maxd < bq.top().first-sq.top().first){ maxd = bq.top().first-sq.top().first; maxi = bq.top().second; mini = sq.top().second; } } for(int i = D+1;i < N;i++){ bq.push(p(X[i],i)); sq.push(p(X[i],i)); while(bq.top().second <= i-D)bq.pop(); while(sq.top().second <= i-D)sq.pop(); if(maxd < bq.top().first-sq.top().first){ maxd = bq.top().first-sq.top().first; maxi = bq.top().second; mini = sq.top().second; } } cout << maxd*K << endl; if(maxd)cout << mini << " " << maxi << endl; }