#include #include #include #include #include using namespace std; #define rep(i,n) for(int i=0;i> n >> d >> k; vectorx(n); for (int i = 0; i < n; i++) { cin >> x[i]; } mapm; pair ans = make_pair(0,0); for (int i = 0; i <= d;i++) { if (m.find(x[i]) == m.end()) { m[x[i]] = 1; }else m[x[i]]++; } auto fin = --m.end(); ans = make_pair(fin->first - x[0], 0); for (int i = d + 1; i < n; i++) { m[x[i - d - 1]]--; if (m[x[i - d - 1]] == 0)m.erase(m.find(x[i - d - 1])); m[x[i]]++; auto fin = --m.end(); if (ans.first < fin->first - x[i - d]) { ans = make_pair(fin->first - x[i - d], i - d); } } cout << (long long)ans.first*k << endl; if (ans.first) { for (int i = ans.second; i <= ans.second + d; i++) { if (x[i] - x[ans.second] == ans.first) { cout << ans.second << " " << i << endl; break; } } } return 0; }