#include using namespace std; #define INF 1001000100010001000 #define MOD 1000000007 #define RMQ_SIZE 262144 #define EPS 1e-10 #define int long long #define rep(i, N) for (int i = 0; i < N; i++) #define Rep(i, N) for (int i = 1; i < N; i++) #define For(i, a, b) for (int i = (a); i < (b); i++) #define pb push_back #define mp make_pair #define i_i pair #define vi vector #define vvi vector #define vb vector #define vvb vector #define vp vector< i_i > #define all(a) (a).begin(), (a).end() #define Int(x) int x; scanf("%lld", &x); #define int2(x, y) int x, y; scanf("%lld %lld", &x, &y); //int dxy[5] = {0, 1, 0, -1, 0}; // assign class segtree { private: i_i dfs(int a,int b,int k,int l,int r) { //* 要求範囲を含まないレンジの探索. if (r <= a || b <= l) { return mp(INF, -1); } //* 木のレンジが要求範囲以下になる時. if (a <= l && r <= b) { return tree[k]; } int m = (l+r)/2; return min(dfs(a, b, k*2+1, l, m), dfs(a, b, k*2+2, m, r)); } i_i min(i_i a, i_i b) { if (a.first < b.first) { return a; } else if (a.first > b.first) { return b; } else if (a.second < b.second) { return a; } else { return b; } } public: int size; i_i *tree; segtree(int tree_size, int c) { size = 2; while (tree_size >>= 1) size++; size = 1<> a >> b >> c; vi input(a, 0); segtree ma(b, -INF); rep(i, a) { cin >> input[i]; ma.update(i, -input[i]); } int ans = 0; i_i ret; rep(i, a) { i_i e = ma.getMin(i, min(i+b+1, a)); //cout << d.second << " " << e.second << endl; if (ans < -e.first - input[i]) { ans = -e.first - input[i]; ret.first = i; ret.second = e.second - 262144/2 + 1; } } if (ans) { cout << ans * c << endl; cout << ret.first << " " << ret.second << endl; } else { cout << 0 << endl; } return 0; }