結果
問題 |
No.1077 Noelちゃんと星々4
|
ユーザー |
![]() |
提出日時 | 2020-06-14 09:19:43 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 713 ms / 2,000 ms |
コード長 | 296 bytes |
コンパイル時間 | 107 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-06-27 00:26:33 |
合計ジャッジ時間 | 5,999 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 |
ソースコード
N = int(input()) Y = list(map(int, input().split())) a = sorted(set(Y)) dp = [0] * len(a) for i in range(len(a)): dp[i] = abs(Y[0] - a[i]) for i in range(1, N): t = float('inf') for j in range(len(a)): t = min(t, dp[j]) dp[j] = t + abs(Y[i] - a[j]) print(min(dp))