結果
| 問題 |
No.1077 Noelちゃんと星々4
|
| コンテスト | |
| ユーザー |
d9et
|
| 提出日時 | 2020-06-12 21:34:25 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 282 bytes |
| コンパイル時間 | 242 ms |
| コンパイル使用メモリ | 82,204 KB |
| 実行使用メモリ | 137,200 KB |
| 最終ジャッジ日時 | 2024-06-24 04:33:12 |
| 合計ジャッジ時間 | 4,430 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | WA * 20 |
ソースコード
n = int(input())
a = list(map(int,input().split()))
mx = max(a)
dp = [[10**18 for i in range(mx+1)] for j in range(n+1)]
for i in range(1,n+1):
x = a[i-1]
mn = 10**18
for j in range(mx+1):
mn = min(mn,dp[i-1][j])
dp[i][j] = mn+abs(x-j)
print(min(dp[-1]))
d9et