Submission #735163

#TimeUsernameProblemLanguageResultExecution timeMemory
735163PoonYaPatRoad Closures (APIO21_roads)C++14
0 / 100
23 ms2484 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n; vector<ll> ans; ll sum=0,dp[100001]; vector<ll> minimum_closure_costs(int N, vector<int> U, vector<int> V, vector<int> W) { for (int i=0; i<n-1; ++i) sum+=W[i]; ans.push_back(sum); dp[0]=0; dp[1]=W[0]; for (int i=2; i<=n-2; ++i) dp[i]=min(dp[i-2],dp[i-1])+W[i-1]; ans.push_back(min(dp[n-2],dp[n-1])); for (int i=2; i<n; ++i) ans.push_back(0); return ans; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...