結果

問題 No.1090 ソーシャルディスタンス / Social Distance
ユーザー zeronosu77108
提出日時 2020-06-24 21:15:39
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 644 bytes
コンパイル時間 966 ms
コンパイル使用メモリ 139,284 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-30 18:44:57
合計ジャッジ時間 5,550 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 10 WA * 13
権限があれば一括ダウンロードができます

ソースコード

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] - x >= d) x = b[i];
        else x = (max(x,b[i])/d+1)*d;
        cout << x << (i!=n-1? " " : "\n");
    }
}
0