結果

問題 No.1090 ソーシャルディスタンス / Social Distance
ユーザー onsen_manjuuu
提出日時 2020-06-24 02:10:19
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 511 bytes
コンパイル時間 1,591 ms
コンパイル使用メモリ 170,412 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-03 19:43:28
合計ジャッジ時間 3,246 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;
using ll = long long;

template<class T> ostream& operator<<(ostream& os, const vector<T> arr){ for(int i = 0; i < (int)arr.size(); i++)cout << arr[i] << (i == (int)arr.size() -1 ? "" : " "); return os;}

int main()
{
    int n, d; cin >> n >> d;
    vector<int> a(n);
    for(int i = 1; i < n; i++) {
        int x; cin >> x; a[i] = a[i - 1] + x;
    }

    for(int i = 1; i < n; i++) {
        a[i] += max(0, d - (a[i] - a[i - 1]));
    }
    cout << a << endl;
}
0