結果
問題 |
No.1090 ソーシャルディスタンス / Social Distance
|
ユーザー |
![]() |
提出日時 | 2020-06-26 06:35:31 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 35 ms / 2,000 ms |
コード長 | 489 bytes |
コンパイル時間 | 1,505 ms |
コンパイル使用メモリ | 168,856 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-03 22:06:12 |
合計ジャッジ時間 | 3,251 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long; template<class T> ostream& operator<<(ostream& os, const vector<T> arr){ for(int i = 0; i < (int)arr.size(); i++)cout << arr[i] << (i == (int)arr.size() -1 ? "" : " "); return os;} int main(){ int n, d; cin >> n >> d; vector<int> a(n); for(int i = 1; i < n; i++) { int x; cin >> x; a[i] = a[i - 1] + x; } for(int i = 1; i < n; i++) { a[i] += max(0, d - (a[i] - a[i - 1])); } cout << a << endl; }