結果

問題 No.489 株に挑戦
ユーザー Yasufu12Yasufu12
提出日時 2017-02-25 00:15:15
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 450 bytes
コンパイル時間 519 ms
コンパイル使用メモリ 58,352 KB
実行使用メモリ 8,884 KB
最終ジャッジ日時 2023-08-31 01:04:41
合計ジャッジ時間 7,200 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 3 ms
4,380 KB
testcase_16 TLE -
testcase_17 AC 5 ms
4,376 KB
testcase_18 AC 170 ms
4,380 KB
testcase_19 AC 458 ms
4,380 KB
testcase_20 TLE -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
権限があれば一括ダウンロードができます

ソースコード

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