結果

問題 No.1090 ソーシャルディスタンス / Social Distance
ユーザー 👑 zeronosu77108zeronosu77108
提出日時 2020-06-24 21:13:16
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 636 bytes
コンパイル時間 1,034 ms
コンパイル使用メモリ 137,596 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-07 22:03:59
合計ジャッジ時間 5,658 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 130 ms
5,376 KB
testcase_08 WA -
testcase_09 AC 146 ms
5,376 KB
testcase_10 AC 175 ms
5,376 KB
testcase_11 WA -
testcase_12 AC 146 ms
5,376 KB
testcase_13 WA -
testcase_14 AC 244 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 116 ms
5,376 KB
testcase_21 WA -
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 298 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() {
    int n,d;
    cin >> n >> d;
    vector a(n,0);
    for (int i=1; i<n; i++) cin >> a[i];
    vector b(n,0);
    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;

    int 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