結果

問題 No.489 株に挑戦
ユーザー kimiyukikimiyuki
提出日時 2017-02-24 23:55:13
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 520 ms / 1,000 ms
コード長 886 bytes
コンパイル時間 378 ms
コンパイル使用メモリ 44,556 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-27 05:14:51
合計ジャッジ時間 5,554 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
4,376 KB
testcase_01 AC 112 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 272 ms
4,380 KB
testcase_17 AC 3 ms
4,380 KB
testcase_18 AC 30 ms
4,376 KB
testcase_19 AC 66 ms
4,380 KB
testcase_20 AC 307 ms
4,380 KB
testcase_21 AC 27 ms
4,376 KB
testcase_22 AC 3 ms
4,380 KB
testcase_23 AC 8 ms
4,376 KB
testcase_24 AC 351 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 513 ms
4,380 KB
testcase_27 AC 35 ms
4,380 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 520 ms
4,376 KB
testcase_31 AC 520 ms
4,380 KB
testcase_32 AC 26 ms
4,380 KB
testcase_33 AC 304 ms
4,376 KB
testcase_34 AC 109 ms
4,376 KB
testcase_35 AC 32 ms
4,376 KB
testcase_36 AC 12 ms
4,376 KB
testcase_37 AC 135 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")
#include <cstdio>
#include <algorithm>
#define repeat(i,n) for (int i = 0; (i) < int(n); ++(i))
#define repeat_from(i,m,n) for (int i = (m); (i) < int(n); ++(i))
using ll = long long;
using namespace std;
constexpr int MAX_N = 1e5;
int x[MAX_N];
int main() {
    int n, d, K; scanf("%d%d%d", &n, &d, &K);
    repeat (i,n) scanf("%d", &x[i]);
    int mx = 0, mj = -1;
    repeat (j,n) {
        int acc = 0;
        repeat_from (k,j,min(n,j+d+1)) acc = max(acc, x[k]);
        if (mx < acc - x[j]) {
            mx = acc - x[j];
            mj = j;
        }
    }
    int mk = -1;
    repeat_from (k,mj,min(n,mj+d+1)) {
        if (mx == x[k] - x[mj]) {
            mk = k;
            break;
        }
    }
    printf("%lld\n", mx*(ll)K);
    if (mx) printf("%d %d\n", mj, mk);
    return 0;
}
0