結果

問題 No.1090 ソーシャルディスタンス / Social Distance
ユーザー zeronosu77108
提出日時 2020-06-24 21:20:32
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
AC  
実行時間 274 ms / 2,000 ms
コード長 646 bytes
コンパイル時間 857 ms
コンパイル使用メモリ 136,588 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-30 18:45:29
合計ジャッジ時間 5,367 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <climits>
#include <map>
#include <queue>
#include <cmath>

using namespace std;

using int64 = long long;

int main() {
    int64 n,d;
    cin >> n >> d;
    vector a(n,0LL);
    for (int i=1; i<n; i++) cin >> a[i];
    vector b(n,0LL);
    for (int i=1; i<n; i++) b[i] = b[i-1] + a[i];
    for (int i=0; i<n; i++) cerr<<b[i]<<" ";cerr<<endl;

    int64 x = 0;
    cout << x << " ";
    for (int i=1; i<n; i++) {
        if (b[i] - b[i-1] < d) {
            b[i] = b[i-1] + d;
        }
        cout << b[i] << (i!=n-1? " " : "\n");
    }
}
0