結果

問題 No.1478 Simple Sugoroku
ユーザー simansiman
提出日時 2022-02-10 00:01:29
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 266 bytes
コンパイル時間 698 ms
コンパイル使用メモリ 11,528 KB
実行使用メモリ 25,068 KB
最終ジャッジ日時 2023-09-07 10:19:09
合計ジャッジ時間 9,293 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,564 KB
testcase_01 AC 78 ms
15,472 KB
testcase_02 AC 78 ms
15,692 KB
testcase_03 AC 79 ms
15,416 KB
testcase_04 AC 80 ms
15,396 KB
testcase_05 WA -
testcase_06 AC 79 ms
15,388 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 82 ms
15,384 KB
testcase_10 AC 79 ms
15,372 KB
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 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 157 ms
24,172 KB
testcase_30 AC 157 ms
24,372 KB
testcase_31 AC 157 ms
24,292 KB
testcase_32 AC 160 ms
24,140 KB
testcase_33 AC 136 ms
22,408 KB
testcase_34 AC 136 ms
22,272 KB
testcase_35 AC 136 ms
22,280 KB
testcase_36 AC 139 ms
22,388 KB
testcase_37 AC 133 ms
21,912 KB
testcase_38 AC 134 ms
21,996 KB
testcase_39 AC 133 ms
21,900 KB
testcase_40 AC 135 ms
21,912 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N, M = gets.split.map(&:to_i)
B = gets.split.map(&:to_i)

ans = N - 1

wp = B.select { |b| B.last <= b + M }
r = Rational(M, wp.size)
val = 0.0

wp.each do |b|
  cnt = B.first + r + (N - b) - 1
  val += cnt
end

puts [ans, Rational(val, wp.size).to_f.round(12)].min
0