結果

問題 No.489 株に挑戦
コンテスト
ユーザー QnjHgn01LafzbZo
提出日時 2017-03-12 13:37:46
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
TLE  
実行時間 -
コード長 920 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,420 ms
コンパイル使用メモリ 83,764 KB
実行使用メモリ 101,056 KB
最終ジャッジ日時 2026-03-19 16:23:28
合計ジャッジ時間 31,874 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23 WA * 1 TLE * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.util.*;
public class A {
    public static void main(String[] args){
        int N, D, K, x[];
        long Max;
        Scanner scan = new Scanner(System.in);
        N = scan.nextInt();
        D = scan.nextInt();
        K = scan.nextInt();
        x = new int[N];
        for(int i = 0; i < N; i++){
            x[i] = scan.nextInt();
        }
        Max = (long)x[D] - x[0];
        int j = 0, k = D;
        for(int h = D; h > 0; h--){
            for(int i = 0; i < N - h; i++){
                if(Max <= (x[N - i - 1] - x[N - i - h - 1])){
                    Max = x[N - i - 1] - x[N - i - h - 1];
                    j = N - i - h - 1;
                    k = N - i - 1;
                }
            }
        }
        if(Max > 0){
            System.out.println(Max * K);
            System.out.println(j + " " + k);
        }
        else{
            System.out.println(0);
        }
    }
}
0