結果

問題 No.489 株に挑戦
ユーザー treeonetreeone
提出日時 2017-02-25 00:23:25
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,041 bytes
コンパイル時間 1,182 ms
コンパイル使用メモリ 145,936 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-31 01:05:51
合計ジャッジ時間 3,190 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define fi first;
#define se second;
using namespace std;
typedef pair<int, int> P;


signed main(){
    int n, d, k;
    cin >> n >> d >> k;
    vector<int> x(n);
    rep(i, 0, n){
        cin >> x[i];
    }
    int ans = -1;
    int l = 0, r = 0;
    int MAX = -1, idl = 0, idr = 0;
    for(l = 0; l < n; l++){
        while(r - l < d && r < n - 1){
            r++;
            if(MAX < x[r]){
                MAX = x[r];
                if(ans < MAX - x[l]){
                    idl = l; idr = r;
                    ans = MAX - x[l];
                // cout << ans << " " << l << " "<< idl <<  " " << r  << " " << idr << endl;
                    
                }
            }
        }
    }
    if(ans == -1) cout << 0 << endl;
    else{
        cout << ans * k << endl;
        cout << idl << " " << idr << endl;
    }
}
0