結果

問題 No.489 株に挑戦
ユーザー kotamanegikotamanegi
提出日時 2017-02-24 22:57:39
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,680 bytes
コンパイル時間 595 ms
コンパイル使用メモリ 85,004 KB
実行使用メモリ 5,756 KB
最終ジャッジ日時 2023-08-30 23:38:27
合計ジャッジ時間 3,805 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
5,088 KB
testcase_01 AC 31 ms
4,548 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 4 ms
4,376 KB
testcase_16 AC 48 ms
5,372 KB
testcase_17 AC 7 ms
4,380 KB
testcase_18 AC 26 ms
4,436 KB
testcase_19 AC 22 ms
4,420 KB
testcase_20 RE -
testcase_21 AC 14 ms
4,376 KB
testcase_22 AC 6 ms
4,380 KB
testcase_23 AC 29 ms
4,544 KB
testcase_24 RE -
testcase_25 AC 1 ms
4,376 KB
testcase_26 RE -
testcase_27 AC 55 ms
5,688 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 RE -
testcase_31 RE -
testcase_32 AC 33 ms
4,648 KB
testcase_33 RE -
testcase_34 AC 51 ms
5,360 KB
testcase_35 AC 21 ms
4,384 KB
testcase_36 AC 9 ms
4,380 KB
testcase_37 AC 33 ms
4,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
long long x[200000] = {};
long long seg[300000] = {};
long long setter(long long now) {
	seg[now] = max(seg[now * 2], seg[now * 2 + 1]);
	if (now != 1) {
		long long wow = setter(now / 2);
	}
	return 0;
}
long long find(long long now, long long n_l,long long n_r,long long w_l,long long w_r) {
	if (n_r - 1 <= w_l || w_r < n_l) return -1;
	if (w_l <= n_l&&n_r-1 <= w_r) return seg[now];
	long long aaa = find(now*2,n_l,(n_l+n_r)/2,w_l,w_r);
	aaa = max(aaa,find(now*2+1,(n_l+n_r)/2,n_r,w_l,w_r));
	return aaa;
}
#define nya 131072
int main() {
	long long n, d, k;
	cin >> n >> d >> k;
	REP(i, n) {
		cin >> x[i];
		seg[nya+i] = x[i];
		setter((nya+i)/2);
	}
	long long hoge = 0;
	long long left = -1;
	for (int i = 0;i < n;++i) {
		long long maxium = find(1, 0, nya + 1, i, i + d);
		if (hoge < (maxium - x[i])) {
			hoge = maxium - x[i];
			left = i;
		}
	}
	if (left == -1) {
		cout << 0 << endl;
		return 0;
	}
	cout << hoge*k << endl;
	cout << left << " ";
	long long max_now = 0;
	long long max_right = 0;
	for (int q = 0;q <= d;++q) {
		if (max_now < x[q + left]) {
			max_now = x[q + left];
			max_right = q + left;
		}
	}
	cout << max_right << endl;
	return 0;
}
0