結果

問題 No.489 株に挑戦
ユーザー mmmpppmmmppp
提出日時 2017-02-25 21:31:27
言語 Ruby
(3.3.0)
結果
AC  
実行時間 229 ms / 1,000 ms
コード長 264 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 11,292 KB
実行使用メモリ 24,920 KB
最終ジャッジ日時 2023-09-27 05:21:51
合計ジャッジ時間 7,187 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 197 ms
21,144 KB
testcase_01 AC 139 ms
20,180 KB
testcase_02 AC 80 ms
15,264 KB
testcase_03 AC 82 ms
15,156 KB
testcase_04 AC 83 ms
15,184 KB
testcase_05 AC 82 ms
15,196 KB
testcase_06 AC 81 ms
15,252 KB
testcase_07 AC 81 ms
15,136 KB
testcase_08 AC 82 ms
15,156 KB
testcase_09 AC 81 ms
15,124 KB
testcase_10 AC 84 ms
15,180 KB
testcase_11 AC 82 ms
15,220 KB
testcase_12 AC 86 ms
15,096 KB
testcase_13 AC 82 ms
15,236 KB
testcase_14 AC 82 ms
15,052 KB
testcase_15 AC 90 ms
15,376 KB
testcase_16 AC 223 ms
21,256 KB
testcase_17 AC 94 ms
16,344 KB
testcase_18 AC 161 ms
19,992 KB
testcase_19 AC 130 ms
18,972 KB
testcase_20 AC 197 ms
21,588 KB
testcase_21 AC 99 ms
16,424 KB
testcase_22 AC 96 ms
15,556 KB
testcase_23 AC 152 ms
20,400 KB
testcase_24 AC 229 ms
24,920 KB
testcase_25 AC 81 ms
15,192 KB
testcase_26 AC 210 ms
24,648 KB
testcase_27 AC 136 ms
22,360 KB
testcase_28 AC 82 ms
15,136 KB
testcase_29 AC 81 ms
15,092 KB
testcase_30 AC 150 ms
22,648 KB
testcase_31 AC 158 ms
24,636 KB
testcase_32 AC 179 ms
20,520 KB
testcase_33 AC 222 ms
24,668 KB
testcase_34 AC 221 ms
21,372 KB
testcase_35 AC 135 ms
17,824 KB
testcase_36 AC 93 ms
16,036 KB
testcase_37 AC 135 ms
20,300 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n,d,K,*x=$<.read.split.map &:to_i
m=[0,0,0]
c=h=x[0]+1
x.each_with_index{|a,j|
  f=[j+d,n-1].min
  next if a>=c&&x[f]<=x[h]
  x[j+1..f].each_with_index{|b,k|
    v=b-a
    break if v<0
    v>m[0]&&m=[v,j,k+j+1]
  }
  h=f
  c=a
}
m[0]<1?p(0):puts(m[0]*K,m[1,2]*' ')
0