結果
| 問題 |
No.1090 ソーシャルディスタンス / Social Distance
|
| ユーザー |
|
| 提出日時 | 2020-09-06 14:58:23 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 33 ms / 2,000 ms |
| コード長 | 589 bytes |
| コンパイル時間 | 565 ms |
| コンパイル使用メモリ | 100,672 KB |
| 実行使用メモリ | 7,104 KB |
| 最終ジャッジ日時 | 2024-06-22 08:56:12 |
| 合計ジャッジ時間 | 2,223 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 |
ソースコード
import std.stdio;
import std.array;
import std.conv;
import std.algorithm;
void main()
{
auto immutable input = readln().split;
auto immutable N = input[0].to!int;
auto immutable D = input[1].to!int;
auto immutable A = readln().split.map!(v => v.to!int).array;
auto result = [0];
auto prev_pos = 0;
foreach (i; 1..N) {
auto pos = A[i-1] + prev_pos;
result ~= pos;
prev_pos = pos;
if (result[i] - result[i-1] < D) {
result[i] = result[i-1] + D;
}
}
writeln(result.map!(a => a.to!string).join(" "));
}