結果

問題 No.1077 Noelちゃんと星々4
コンテスト
ユーザー tktk_snsn
提出日時 2020-06-12 22:26:08
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 1,860 ms / 2,000 ms
+ 789µs
コード長 264 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 143 ms
コンパイル使用メモリ 15,104 KB
実行使用メモリ 11,776 KB
最終ジャッジ日時 2026-10-13 11:26:26
合計ジャッジ時間 21,149 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from itertools import accumulate
N = int(input())
A = list(map(int, input().split()))
U = 10 ** 4 + 10
inf = 10 ** 18

dp = [i for i in range(U)]
for a in A:
    dp = list(accumulate(dp, func=min))
    dp = [x + abs(i - a) for i, x in enumerate(dp)]
print(min(dp))
0