結果
問題 |
No.1090 ソーシャルディスタンス / Social Distance
|
ユーザー |
![]() |
提出日時 | 2020-06-26 00:02:02 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 36 ms / 2,000 ms |
コード長 | 541 bytes |
コンパイル時間 | 1,251 ms |
コンパイル使用メモリ | 158,680 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-03 22:00:03 |
合計ジャッジ時間 | 3,063 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 |
ソースコード
/** * @FileName a.cpp * @Author kanpurin * @Created 2020.06.26 00:01:57 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { int n,d;cin >> n >> d; vector<int> a(n); a[0] = 0; for (int i = 0; i < n-1; i++) { int k;cin >> k; a[i + 1] = a[i] + k; } cout << a[0] << " "; for (int i = 0; i < n - 1; i++) { if (a[i + 1] < a[i] + d) { a[i + 1] = a[i] + d; } cout << a[i + 1] << " "; } cout << endl; return 0; }