結果

問題 No.489 株に挑戦
ユーザー nukachanukacha
提出日時 2017-10-17 01:47:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 864 bytes
コンパイル時間 666 ms
コンパイル使用メモリ 69,632 KB
実行使用メモリ 9,808 KB
最終ジャッジ日時 2024-04-28 23:58:42
合計ジャッジ時間 4,713 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
9,680 KB
testcase_01 AC 19 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 3 ms
5,376 KB
testcase_16 AC 26 ms
5,376 KB
testcase_17 AC 6 ms
5,376 KB
testcase_18 AC 16 ms
5,376 KB
testcase_19 AC 13 ms
5,376 KB
testcase_20 AC 31 ms
5,376 KB
testcase_21 AC 9 ms
5,376 KB
testcase_22 AC 5 ms
5,376 KB
testcase_23 AC 20 ms
5,376 KB
testcase_24 AC 36 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 31 ms
5,376 KB
testcase_27 AC 31 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 35 ms
5,376 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