제출 #265443

#제출 시각아이디문제언어결과실행 시간메모리
265443eohomegrownappsDischarging (NOI20_discharging)C++14
36 / 100
1093 ms1196 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll dp[500000]; ll arr[500000]; int main(){ cin.tie(0); ios_base::sync_with_stdio(0); int n; cin>>n; dp[0]=0; for (int i = 1; i<=n; i++){ cin>>arr[i]; ll mxv = arr[i]; dp[i]=1e18; for (int x = i-1; x>=0; x--){ mxv=max(mxv,arr[x]); dp[i]=min(dp[i],(n-x)*mxv+dp[x]); } //cout<<dp[i]<<'\n'; } cout<<dp[n]<<'\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...