제출 #1008775

#제출 시각아이디문제언어결과실행 시간메모리
1008775Rolo678Discharging (NOI20_discharging)C++14
0 / 100
1014 ms25680 KiB
#include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<long long>a(n+1); for(int i = 1;i<=n;i++)cin >>a[i]; vector<long long>dp(n+1,1e15); for(int i = 1;i<=n;i++) { long long mx= 0; for(int j = 1;j<=i;j++) { mx = max(a[j],mx); dp[i] = min(dp[j-1] + (i-j+1)*mx,dp[i]); } } 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...