結果
| 問題 | 
                            No.1090 ソーシャルディスタンス / Social Distance
                             | 
                    
| ユーザー | 
                             kekenx
                         | 
                    
| 提出日時 | 2020-07-05 20:47:02 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 38 ms / 2,000 ms | 
| コード長 | 458 bytes | 
| コンパイル時間 | 1,588 ms | 
| コンパイル使用メモリ | 169,352 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-09-22 21:13:42 | 
| 合計ジャッジ時間 | 3,976 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 23 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d;
  cin >> n >> d;
  vector<int> a(n);
  a[0] = 0;
  int pre = 0;
  for (int i = 1; i < n; ++i) {
    cin >> a[i];
    a[i] += pre;
    pre = a[i];
  }
  for (int i = 1; i < n; ++i) {
    int dist = a[i - 1] + d;
    if (a[i] < dist) {
      a[i] = dist;
    }
  }
  for (int i = 0; i < n; ++i) {
    cout << a[i];
    if (i == n - 1) puts("");
    else cout << " ";
  }
  return 0;
}
            
            
            
        
            
kekenx