This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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-1; ++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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |