結果
問題 |
No.1077 Noelちゃんと星々4
|
ユーザー |
![]() |
提出日時 | 2020-06-12 21:53:03 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 390 bytes |
コンパイル時間 | 111 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 188,320 KB |
最終ジャッジ日時 | 2024-06-24 04:53:40 |
合計ジャッジ時間 | 3,795 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | TLE * 1 -- * 19 |
ソースコード
import sys input=lambda: sys.stdin.readline().rstrip() n=int(input()) Y=[int(i) for i in input().split()] DP=[[0]*(10**4+1) for _ in range(n+1)] for i,y in enumerate(Y): m=DP[i][0] for j in range(10**4+1): if i==0: DP[i+1][j]=abs(j-y) else: if j==0: DP[i+1][j]=DP[i][0]+y else: m=min(DP[i][j],m) DP[i+1][j]=m+abs(j-y) print(min(DP[n]))