結果

問題 No.1090 ソーシャルディスタンス / Social Distance
ユーザー shi-moshi-mo
提出日時 2020-09-29 00:45:39
言語 Ruby
(3.3.0)
結果
AC  
実行時間 182 ms / 2,000 ms
コード長 213 bytes
コンパイル時間 43 ms
コンパイル使用メモリ 11,260 KB
実行使用メモリ 26,364 KB
最終ジャッジ日時 2023-09-15 21:49:39
合計ジャッジ時間 5,135 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,084 KB
testcase_01 AC 84 ms
15,136 KB
testcase_02 AC 145 ms
21,448 KB
testcase_03 AC 92 ms
15,472 KB
testcase_04 AC 157 ms
21,104 KB
testcase_05 AC 89 ms
15,564 KB
testcase_06 AC 169 ms
21,756 KB
testcase_07 AC 131 ms
20,348 KB
testcase_08 AC 180 ms
25,792 KB
testcase_09 AC 133 ms
20,760 KB
testcase_10 AC 146 ms
21,088 KB
testcase_11 AC 182 ms
25,920 KB
testcase_12 AC 135 ms
20,896 KB
testcase_13 AC 134 ms
20,732 KB
testcase_14 AC 169 ms
21,748 KB
testcase_15 AC 153 ms
21,328 KB
testcase_16 AC 116 ms
17,884 KB
testcase_17 AC 84 ms
15,248 KB
testcase_18 AC 114 ms
18,040 KB
testcase_19 AC 134 ms
20,368 KB
testcase_20 AC 123 ms
19,480 KB
testcase_21 AC 134 ms
20,748 KB
testcase_22 AC 83 ms
15,084 KB
testcase_23 AC 82 ms
15,116 KB
testcase_24 AC 181 ms
26,364 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n, d = gets.split.map(&:to_i)
a = gets.chomp.split.map(&:to_i)
x = [0]
(n-1).times do |i|
  if d <= a[i]
    x << x[i] + a[i]
    next
  end
  a[i+1] -= (d - a[i]) if i < (n-2)
  x << x[i] + d
end
puts x.join(' ')
0