結果

問題 No.1090 ソーシャルディスタンス / Social Distance
ユーザー mmn15277198
提出日時 2020-06-28 23:04:34
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 613 bytes
コンパイル時間 1,085 ms
コンパイル使用メモリ 99,400 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-08 10:04:14
合計ジャッジ時間 3,863 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("Ofast")
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

const long long INF = 1e17+7;
const long long MOD = 1e9+7;
const double PI=acos(-1);

using namespace std;

int main(){
	int n,d;
	cin >> n >> d;
	vector<int> a(n,0);
	vector<int> dist(n,0);
	for(int i=1;i<n;i++){
		cin >> a[i];
		dist[i]+=a[i];
		dist[i]+=dist[i-1];
	}
	for(int i=1;i<n;i++){
		if((dist[i]-dist[i-1])<d){
			dist[i]=dist[i-1]+d;
		}
	}
	for(int i=0;i<n;i++){
		cout << dist[i] << " ";
	}
	cout << endl;
}

0