結果

問題 No.929 よくあるボールを移動するやつ
ユーザー 👑 rin204
提出日時 2020-06-30 15:47:58
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 180 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 12,840 KB
最終ジャッジ日時 2024-07-23 19:03:39
合計ジャッジ時間 2,128 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
blst = list(map(int, input().split()))
ans = 0
b = 0
for num in blst:
    if num == 0:
        b += 1
    else:
        b -= (num - 1)
    ans += abs(b)
print(ans)
0