結果

問題 No.1090 ソーシャルディスタンス / Social Distance
ユーザー brthyyjpbrthyyjp
提出日時 2020-09-22 07:16:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 126 ms / 2,000 ms
コード長 351 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 101,544 KB
最終ジャッジ日時 2023-09-07 23:34:48
合計ジャッジ時間 5,736 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,244 KB
testcase_01 AC 78 ms
71,300 KB
testcase_02 AC 111 ms
92,592 KB
testcase_03 AC 87 ms
76,860 KB
testcase_04 AC 115 ms
95,024 KB
testcase_05 AC 84 ms
77,040 KB
testcase_06 AC 116 ms
98,080 KB
testcase_07 AC 102 ms
87,144 KB
testcase_08 AC 121 ms
100,492 KB
testcase_09 AC 103 ms
87,444 KB
testcase_10 AC 110 ms
90,632 KB
testcase_11 AC 126 ms
101,544 KB
testcase_12 AC 105 ms
88,580 KB
testcase_13 AC 106 ms
88,680 KB
testcase_14 AC 124 ms
97,888 KB
testcase_15 AC 110 ms
92,628 KB
testcase_16 AC 98 ms
82,412 KB
testcase_17 AC 86 ms
76,812 KB
testcase_18 AC 97 ms
83,032 KB
testcase_19 AC 99 ms
85,892 KB
testcase_20 AC 99 ms
84,760 KB
testcase_21 AC 102 ms
88,588 KB
testcase_22 AC 72 ms
71,456 KB
testcase_23 AC 72 ms
71,312 KB
testcase_24 AC 124 ms
101,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, d = map(int, input().split())
A = list(map(int, input().split()))
X = [0]*n
for i in range(1, n):
    X[i] = X[i-1]+A[i-1]
ans = []
for i in range(n):
    if i == 0:
        ans.append(X[i])
    else:
        if X[i]-X[i-1] >= d:
            ans.append(X[i])
        else:
            X[i] += d-X[i]+X[i-1]
            ans.append(X[i])
print(*ans)
0