結果
| 問題 | 
                            No.1090 ソーシャルディスタンス / Social Distance
                             | 
                    
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-12-21 20:53:23 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 450 bytes | 
| コンパイル時間 | 1,961 ms | 
| コンパイル使用メモリ | 170,004 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-09-21 13:04:56 | 
| 合計ジャッジ時間 | 4,355 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 WA * 1 | 
| other | AC * 9 WA * 14 | 
ソースコード
#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;
}