結果
| 問題 |
No.1077 Noelちゃんと星々4
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-02-25 23:51:44 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 142 ms / 2,000 ms |
| コード長 | 202 bytes |
| コンパイル時間 | 161 ms |
| コンパイル使用メモリ | 82,172 KB |
| 実行使用メモリ | 76,224 KB |
| 最終ジャッジ日時 | 2024-10-01 14:51:21 |
| 合計ジャッジ時間 | 3,209 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 20 |
ソースコード
N=int(input())
Y=list(map(int, input().split()))
dp=[0]*(max(Y)+1)
for i in range(N):
m=float("inf")
for l in range(max(Y)+1):
m=min(dp[l],m)
dp[l]=m+abs(Y[i]-l)
print(min(dp))