結果

問題 No.489 株に挑戦
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2017-02-24 22:42:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,216 bytes
コンパイル時間 1,541 ms
コンパイル使用メモリ 165,476 KB
実行使用メモリ 11,880 KB
最終ジャッジ日時 2023-08-30 23:31:01
合計ジャッジ時間 3,709 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 4 ms
11,080 KB
testcase_03 AC 5 ms
11,080 KB
testcase_04 AC 4 ms
11,188 KB
testcase_05 AC 5 ms
11,392 KB
testcase_06 AC 5 ms
11,312 KB
testcase_07 AC 5 ms
11,280 KB
testcase_08 AC 5 ms
11,084 KB
testcase_09 AC 5 ms
11,188 KB
testcase_10 AC 5 ms
11,132 KB
testcase_11 AC 5 ms
11,256 KB
testcase_12 AC 5 ms
11,272 KB
testcase_13 AC 4 ms
11,080 KB
testcase_14 AC 4 ms
11,192 KB
testcase_15 AC 6 ms
11,324 KB
testcase_16 AC 33 ms
11,564 KB
testcase_17 AC 8 ms
11,132 KB
testcase_18 AC 21 ms
11,636 KB
testcase_19 AC 18 ms
11,268 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 5 ms
11,244 KB
testcase_26 AC 42 ms
11,636 KB
testcase_27 AC 41 ms
11,708 KB
testcase_28 WA -
testcase_29 AC 5 ms
11,136 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)




#define def -INT_MAX/2
template<class V, int NV> class SegTree { // by kmjp
public:
	V comp(V l, V r) { return max(l, r); };

	vector<V> val;
	SegTree() { val = vector<V>(NV * 2, def); }

	V getval(int l, int r) { //[l,r]
		l += NV; r += NV + 1;
		V ret = def;
		while (l < r) {
			if (l & 1) ret = comp(ret, val[l++]);
			if (r & 1) ret = comp(ret, val[--r]);
			l /= 2; r /= 2;
		}
		return ret;
	}
	void update(int i, V v) {
		i += NV;
		val[i] = v;
		while (i>1) i >>= 1, val[i] = comp(val[i * 2], val[i * 2 + 1]);
	}
};
//-----------------------------------------------------------------
int N, D, K;
int X[101010];
SegTree<int, 1 << 20> st;
//-----------------------------------------------------------------
int main() {
	cin >> N >> D >> K;
	rep(i, 0, N) cin >> X[i];
	rep(i, 0, N) st.update(i, X[i]);

	int L = -1, C = 0;
	rep(i, 0, N - 1) {
		int a = X[i];
		int b = st.getval(i + 1, i + D);

		int d = b - a;
		if (C < d) {
			C = d;
			L = i;
		}
	}

	if (L < 0) {
		printf("0\n");
		return 0;
	}

	rep(i, L, N) {
		if (X[i] == X[L] + C) {
			printf("%d\n", C * K);
			printf("%d %d\n", L, i);
			return 0;
		}
	}
}
0