Submission #1012405

#TimeUsernameProblemLanguageResultExecution timeMemory
1012405LuvidiDischarging (NOI20_discharging)C++17
36 / 100
1055 ms25540 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<ll, ll> #define pii pair<int, int> #define fs first #define sc second #define pb push_back void solve() { ll n; cin>>n; ll a[n+1]; for(int i=1;i<=n;i++)cin>>a[i]; ll dp[n+1]; dp[0]=0; for(int i=1;i<=n;i++){ dp[i]=1e18; ll m=0; for(ll j=i;j;j--){ m=max(m,a[j]); dp[i]=min(dp[i],dp[j-1]+m*(n-j+1)); } } cout<<dp[n]; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); solve(); }
#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...