제출 #837169

#제출 시각아이디문제언어결과실행 시간메모리
83716912345678Discharging (NOI20_discharging)C++17
36 / 100
1058 ms13488 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const int nx=1e6+5; ll n, t[nx], dp[nx]; int main() { cin.tie(NULL)->sync_with_stdio(false); cin>>n; for (int i=1; i<=n; i++) cin>>t[i]; for (int i=1; i<=n; i++) { ll mx=t[i]; dp[i]=1e18; for (int j=i-1; j>=0; j--) dp[i]=min(dp[i], dp[j]+mx*(n-j)), mx=max(mx, t[j]); //cout<<i<<' '<<dp[i]<<'\n'; } cout<<dp[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...