結果
問題 | No.1077 Noelちゃんと星々4 |
ユーザー | tktk_snsn |
提出日時 | 2020-06-12 22:26:51 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 393 ms / 2,000 ms |
コード長 | 249 bytes |
コンパイル時間 | 302 ms |
コンパイル使用メモリ | 82,564 KB |
実行使用メモリ | 90,424 KB |
最終ジャッジ日時 | 2024-06-24 05:18:38 |
合計ジャッジ時間 | 5,681 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 |
ソースコード
from itertools import accumulate N = int(input()) A = list(map(int, input().split())) U = 10 ** 4 + 10 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))