結果

問題 No.1090 ソーシャルディスタンス / Social Distance
ユーザー arito_asuarito_asu
提出日時 2020-07-01 18:07:12
言語 Ruby
(3.3.0)
結果
AC  
実行時間 191 ms / 2,000 ms
コード長 214 bytes
コンパイル時間 58 ms
コンパイル使用メモリ 11,368 KB
実行使用メモリ 25,584 KB
最終ジャッジ日時 2023-10-12 02:40:03
合計ジャッジ時間 5,478 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
15,292 KB
testcase_01 AC 81 ms
15,352 KB
testcase_02 AC 148 ms
21,036 KB
testcase_03 AC 92 ms
15,472 KB
testcase_04 AC 160 ms
20,964 KB
testcase_05 AC 89 ms
15,568 KB
testcase_06 AC 171 ms
21,560 KB
testcase_07 AC 131 ms
20,240 KB
testcase_08 AC 186 ms
25,456 KB
testcase_09 AC 135 ms
20,648 KB
testcase_10 AC 147 ms
21,196 KB
testcase_11 AC 186 ms
25,340 KB
testcase_12 AC 138 ms
20,556 KB
testcase_13 AC 138 ms
20,488 KB
testcase_14 AC 176 ms
21,336 KB
testcase_15 AC 158 ms
21,156 KB
testcase_16 AC 118 ms
18,096 KB
testcase_17 AC 86 ms
15,176 KB
testcase_18 AC 117 ms
18,156 KB
testcase_19 AC 134 ms
20,268 KB
testcase_20 AC 128 ms
19,172 KB
testcase_21 AC 138 ms
20,672 KB
testcase_22 AC 83 ms
15,240 KB
testcase_23 AC 83 ms
15,268 KB
testcase_24 AC 191 ms
25,584 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n,d=gets.split.map(&:to_i)
a=gets.split.map(&:to_i)

ls = [0]

a.each{|x|ls << ls[-1] + x}

for i in 0..n-2 do
    dif = ls[i+1] - ls[i]
    if dif < d then
        ls[i+1] += (d-dif)
    end
end

puts ls.join(' ')
0