結果

問題 No.489 株に挑戦
ユーザー nukachanukacha
提出日時 2017-02-25 00:20:49
言語 C++11
(gcc 11.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 864 bytes
コンパイル時間 438 ms
コンパイル使用メモリ 59,964 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-09-02 07:56:15
合計ジャッジ時間 4,159 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>

int main() {
    long n, d, k;
    long b, s;
    long max = 0;
    b = 0; s = 0;
    std::cin >> n >> d >> k;
    std::vector<long> v;
    for (long i = 0; i < n; i++) {
        long input;
        std::cin >> input;
        v.push_back(input);
    }
    for (long i = n - 1; i > -1; i--) {
        for (long j = i - 1; j > (i - d - 1) && j > -1; j--) {
            long tmp = v[i] - v[j];
            if (tmp <= 0) {
                break;
            } else if (tmp > 0) {
                if (tmp >= max) {
                    max = tmp;
                    s = i;
                    b = j;
                }
            }
            
        }
    }
    if (max == 0) {
        std::cout << 0 << std::endl;
    } else {
        std::cout << max * k << std::endl;
        std::cout << b << " " << s << std::endl;
    }
}
0