結果

問題 No.489 株に挑戦
ユーザー Yasufu12
提出日時 2017-02-25 00:15:15
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 450 bytes
コンパイル時間 543 ms
コンパイル使用メモリ 59,832 KB
実行使用メモリ 13,644 KB
最終ジャッジ日時 2025-01-03 02:08:03
合計ジャッジ時間 22,752 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 WA * 8 TLE * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int n, d, k, x[100000] = {}, ans = 0, a = 0, b = 0;

int main(){
	cin >> n >> d >> k;
	for (int i = 0; i < n; i++){
		cin >> x[i];
	}

	for (int i = 0; i < n - 1; i++){
		for (int j = i + 1; j <= min(i + d, n - 1); j++){
			if (x[j] - x[i] > ans){
				ans = x[j] - x[i];
				a = i;
				b = j;
			}
		}
	}

	cout << ans * k << "\n";

	if (ans > 0){
		cout << a << ' ' << b;
	}

	return 0;
}
0