結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 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 135 ms
5,376 KB
testcase_10 AC 170 ms
5,376 KB
testcase_11 WA -
testcase_12 AC 145 ms
5,376 KB
testcase_13 WA -
testcase_14 AC 253 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 109 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 292 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*d;
        cout << x << (i!=n-1? " " : "\n");
        x++;
    }
}
0