結果

問題 No.489 株に挑戦
ユーザー __dAi00
提出日時 2017-02-24 23:39:36
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 566 bytes
コンパイル時間 826 ms
コンパイル使用メモリ 67,908 KB
実行使用メモリ 12,068 KB
最終ジャッジ日時 2025-01-03 00:40:42
合計ジャッジ時間 23,636 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 TLE * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

int main(){
	long long N, D, K;
	

	cin >> N >> D >> K;
	
	long long x[N];
	for (int i=0; i<N; i++) {
		cin >> x[i];
	}

	long long max = 0;
	int max_j, max_k;
	for (int buy=0; buy<N; buy++) {
		for (int sell=buy+1; sell<=buy+D && sell<N; sell++) {
			long long get = (x[sell] - x[buy]);
			if (get > max) {
				max = get;
				max_j = buy;
				max_k = sell;
			}
		}
	}
	cout << K * max << endl;
	if (max != 0) {
		cout << max_j << " " << max_k << endl;
	}
	return 0;
}
0