結果
問題 | No.595 登山 |
ユーザー |
|
提出日時 | 2017-11-19 11:41:22 |
言語 | Python2 (2.7.18) |
結果 |
WA
|
実行時間 | - |
コード長 | 215 bytes |
コンパイル時間 | 197 ms |
コンパイル使用メモリ | 6,912 KB |
実行使用メモリ | 23,740 KB |
最終ジャッジ日時 | 2024-11-25 22:26:45 |
合計ジャッジ時間 | 8,425 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 24 WA * 1 |
ソースコード
#yuki_595n,p=map(int,raw_input().split())h=map(int,raw_input().split())l=0r=float('inf')for i in xrange(1,n):l=min((min(l,r)+p),l+max(h[i]-h[i-1],0))r=min((min(l,r)+p),r+max(h[i-1]-h[i],0))print min(l,r)