# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
737314 | keisuke6 | Road Closures (APIO21_roads) | C++14 | 68 ms | 6808 KiB |
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 "roads.h"
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
std::vector<ll> minimum_closure_costs(int N, std::vector<int> U, std::vector<int> V, std::vector<int> W) {
vector<ll> A = {};
ll a = 0;
for(int i=0;i<W.size();i++) a += W[i];
A.push_back(a);
vector<ll> dp(N,1e18);
dp[0] = 0;
for(int i=0;i<N-1;i++){
dp[i+1] = min(dp[i+1],dp[i]+W[i]);
if(i+2 < N) dp[i+2] = min(dp[i+2],dp[i]+W[i+1]);
}
A.push_back(min(dp[N-2],dp[N-1]));
while(A.size() != N) A.push_back(0);
return A;
}
Compilation message (stderr)
# | 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... |