結果
問題 | No.1077 Noelちゃんと星々4 |
ユーザー |
![]() |
提出日時 | 2020-06-14 09:20:08 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 64 ms / 2,000 ms |
コード長 | 296 bytes |
コンパイル時間 | 240 ms |
コンパイル使用メモリ | 82,508 KB |
実行使用メモリ | 73,880 KB |
最終ジャッジ日時 | 2024-06-27 00:26:35 |
合計ジャッジ時間 | 2,142 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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))