結果

問題 No.489 株に挑戦
ユーザー nukachanukacha
提出日時 2017-02-25 00:16:46
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 855 bytes
コンパイル時間 470 ms
コンパイル使用メモリ 61,024 KB
実行使用メモリ 8,888 KB
最終ジャッジ日時 2023-08-31 01:04:48
合計ジャッジ時間 4,186 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>

int main() {
    int n, d, k;
    int b, s;
    int max = 0;
    b = 0; s = 0;
    std::cin >> n >> d >> k;
    std::vector<int> v;
    for (int i = 0; i < n; i++) {
        int input;
        std::cin >> input;
        v.push_back(input);
    }
    for (int i = n - 1; i > -1; i--) {
        for (int j = i - 1; j > (i - d - 1) && j > -1; j--) {
            int 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