結果

問題 No.1090 ソーシャルディスタンス / Social Distance
ユーザー 👑 zeronosu77108zeronosu77108
提出日時 2020-06-24 21:20:32
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 302 ms / 2,000 ms
コード長 646 bytes
コンパイル時間 1,078 ms
コンパイル使用メモリ 137,736 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-07 22:04:36
合計ジャッジ時間 6,120 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 191 ms
5,376 KB
testcase_03 AC 29 ms
5,376 KB
testcase_04 AC 218 ms
5,376 KB
testcase_05 AC 19 ms
5,376 KB
testcase_06 AC 268 ms
5,376 KB
testcase_07 AC 137 ms
5,376 KB
testcase_08 AC 282 ms
5,376 KB
testcase_09 AC 143 ms
5,376 KB
testcase_10 AC 188 ms
5,376 KB
testcase_11 AC 294 ms
5,376 KB
testcase_12 AC 154 ms
5,376 KB
testcase_13 AC 149 ms
5,376 KB
testcase_14 AC 264 ms
5,376 KB
testcase_15 AC 203 ms
5,376 KB
testcase_16 AC 92 ms
5,376 KB
testcase_17 AC 9 ms
5,376 KB
testcase_18 AC 98 ms
5,376 KB
testcase_19 AC 135 ms
5,376 KB
testcase_20 AC 117 ms
5,376 KB
testcase_21 AC 157 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 302 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

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