結果

問題 No.1090 ソーシャルディスタンス / Social Distance
ユーザー pyranine
提出日時 2020-12-21 20:55:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 37 ms / 2,000 ms
コード長 450 bytes
コンパイル時間 1,539 ms
コンパイル使用メモリ 169,984 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-21 13:05:00
合計ジャッジ時間 3,391 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  int64_t n, d;
  cin >> n >> d;
  vector<int64_t> a(n);
  a[0] = 0;
  for (int64_t i = 1; i < n; i++) cin >> a[i];
  vector<int64_t> ans = {0};
  for (int64_t i = 1; i < n; i++) ans.emplace_back(ans.back() + a[i]);
  for (int64_t i = 1; i < n; i++) if (ans[i] - ans[i-1] < d) ans[i] = ans[i - 1] + d;
  for (const auto &p : ans) cout << p << (&p == &ans.back() ? '\n' : ' ');
  return 0;
}
0