結果

問題 No.1090 ソーシャルディスタンス / Social Distance
ユーザー QCFium
提出日時 2020-06-24 14:12:31
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 416 bytes
コンパイル時間 1,509 ms
コンパイル使用メモリ 167,252 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-03 20:08:49
合計ジャッジ時間 3,071 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

int ri() {
    int n;
    scanf("%d", &n);
    return n;
}

int main() {
    int n = ri();
    int d = ri();
    int res[n];
    res[0] = 0;
    for (int i = 1; i < n; i++) res[i] = res[i - 1] + ri();
    for (int i = 1; i < n; i++) res[i] = std::max(res[i], res[i - 1] + d);
    for (auto i : res) {
        if (i) printf(" ");
        printf("%d", i);
    }
    puts("");
    return 0;
}
0