結果
| 問題 | No.1077 Noelちゃんと星々4 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-02-25 23:51:44 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 88 ms / 2,000 ms |
| コード長 | 202 bytes |
| 記録 | |
| コンパイル時間 | 287 ms |
| コンパイル使用メモリ | 85,080 KB |
| 実行使用メモリ | 80,820 KB |
| 最終ジャッジ日時 | 2026-04-17 16:25:26 |
| 合計ジャッジ時間 | 2,762 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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))