結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 134 ms
5,376 KB
testcase_08 WA -
testcase_09 AC 142 ms
5,376 KB
testcase_10 AC 179 ms
5,376 KB
testcase_11 WA -
testcase_12 AC 150 ms
5,376 KB
testcase_13 WA -
testcase_14 AC 251 ms
5,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 8 ms
5,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 108 ms
5,376 KB
testcase_21 WA -
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 289 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] - x >= d) x = b[i];
        else x = (max(x,b[i])/d+1)*d;
        cout << x << (i!=n-1? " " : "\n");
    }
}
0