結果
問題 | No.489 株に挑戦 |
ユーザー | yun_app |
提出日時 | 2017-03-01 14:16:55 |
言語 | Java21 (openjdk 21) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,784 bytes |
コンパイル時間 | 2,086 ms |
コンパイル使用メモリ | 74,904 KB |
実行使用メモリ | 59,616 KB |
最終ジャッジ日時 | 2023-09-02 22:55:54 |
合計ジャッジ時間 | 9,095 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 331 ms
59,616 KB |
testcase_01 | TLE | - |
testcase_02 | AC | 75 ms
52,184 KB |
testcase_03 | AC | 80 ms
52,280 KB |
testcase_04 | AC | 42 ms
49,560 KB |
testcase_05 | AC | 72 ms
51,392 KB |
testcase_06 | AC | 74 ms
53,184 KB |
testcase_07 | AC | 71 ms
50,544 KB |
testcase_08 | AC | 70 ms
53,720 KB |
testcase_09 | AC | 76 ms
52,084 KB |
testcase_10 | AC | 79 ms
52,264 KB |
testcase_11 | AC | 76 ms
52,432 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 79 ms
52,808 KB |
testcase_15 | AC | 138 ms
53,952 KB |
testcase_16 | TLE | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
ソースコード
/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ class Main { public static void main (String[] args) throws java.lang.Exception { // your code goes here BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] line = br.readLine().split(" "); int N = Integer.parseInt(line[0]); int D = Integer.parseInt(line[1]); long K = Long.parseLong(line[2]); ArrayList<Long> map = new ArrayList<Long>(); for(int i=0;i<N;i++){ map.add(Long.parseLong(br.readLine())); } Ans ans = new Ans(); for(int i=0;i<N-D+1;i++){ Ans tmp = calc(map,i,D); if(tmp.getDiff() > ans.getDiff()){ ans = tmp; } } if(ans.getDiff()==0){ System.out.println(0); }else{ System.out.println(K*ans.getDiff()); System.out.println(ans.start + " " + ans.end); } } private static Ans calc(ArrayList<Long> map,int s,int d){ Ans ans = new Ans(); ans.start = s; ans.start_c = map.get(s); ans.end = ans.start; ans.end_c = ans.start_c; for(int i=s;i<=s+d&&i<map.size();i++){ if(ans.end_c < map.get(i)){ ans.end = i; ans.end_c = map.get(i); } } return ans; } private static class Ans{ long start; long start_c; long end; long end_c; public long getDiff(){ return end_c-start_c; } } }