結果

問題 No.1090 ソーシャルディスタンス / Social Distance
ユーザー kokatsukokatsu
提出日時 2022-03-17 21:29:32
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 297 bytes
コンパイル時間 2,330 ms
コンパイル使用メモリ 211,164 KB
実行使用メモリ 9,372 KB
最終ジャッジ日時 2023-09-04 16:25:25
合計ジャッジ時間 5,880 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 30 ms
7,436 KB
testcase_03 AC 5 ms
4,376 KB
testcase_04 AC 34 ms
7,792 KB
testcase_05 AC 4 ms
4,376 KB
testcase_06 AC 41 ms
8,072 KB
testcase_07 AC 21 ms
7,240 KB
testcase_08 AC 42 ms
8,864 KB
testcase_09 AC 23 ms
6,916 KB
testcase_10 AC 29 ms
7,780 KB
testcase_11 AC 45 ms
9,372 KB
testcase_12 AC 24 ms
6,964 KB
testcase_13 AC 24 ms
5,928 KB
testcase_14 AC 40 ms
8,748 KB
testcase_15 AC 32 ms
8,152 KB
testcase_16 AC 15 ms
5,016 KB
testcase_17 AC 3 ms
4,376 KB
testcase_18 AC 16 ms
5,152 KB
testcase_19 AC 22 ms
5,676 KB
testcase_20 AC 19 ms
5,352 KB
testcase_21 AC 24 ms
6,024 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 46 ms
8,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

void main() {
    long N, D;
    readf("%d %d\n", N, D);

    auto a = [0L] ~ readln.chomp.split.to!(long[]);

    auto b = a.cumulativeFold!"a + b".array;
    foreach (i; 1 .. N) {
        long d = b[i] - b[i-1];
        if (d < D) b[i] += D - d;
    }

    writefln("%(%s %)", b);
}
0