結果

問題 No.1090 ソーシャルディスタンス / Social Distance
ユーザー tktk_snsn
提出日時 2021-03-30 21:29:41
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 34 ms / 2,000 ms
コード長 411 bytes
コンパイル時間 582 ms
コンパイル使用メモリ 71,424 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-30 21:55:20
合計ジャッジ時間 2,905 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int n, d;
    cin >> n >> d;
    vector<int> a(n);
    a[0] = 0;
    for(int i=1; i<n; ++i) {
        cin >> a[i];
        a[i] += a[i-1];
    }
    for(int i=0; i<n; ++i) {
        if (i) {
            a[i] = max(a[i], a[i-1]+d);
            cout << " ";
        }
        cout << a[i];
    }
    cout << endl;
}
0