結果

問題 No.1090 ソーシャルディスタンス / Social Distance
ユーザー KKT89
提出日時 2020-06-24 14:16:28
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 398 bytes
コンパイル時間 901 ms
コンパイル使用メモリ 76,956 KB
最終ジャッジ日時 2025-01-11 09:50:49
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n,k; cin >> n >> k;
	printf("0");
	int last=0;
	int sum=0;
	for(int i=2;i<=n;i++){
		int a; cin >> a;
		sum+=a;
		a=sum;
		printf(" %d",max(last+k,a));
		last=max(last+k,a);
	}
	printf("\n");
}
0