Submission #976416

#TimeUsernameProblemLanguageResultExecution timeMemory
976416josanneo22Road Closures (APIO21_roads)C++17
0 / 100
30 ms4132 KiB
#include "roads.h" #include <vector> #include <bits/stdc++.h> using namespace std; using i64 = long long; #define vi vector<int> vector<i64> minimum_closure_costs(int N, vi U, vi V, vi W) { vector<i64> ans(N); ans[0] = accumulate(W.begin(), W.end(), 0LL); vector<i64> dp(N); dp[0] = 0; dp[1] = W[0]; for (int i = 2; i < N; i++) { // 0, 1, 2, ..., i - 1, i, ..., N - 1 dp[i] = min(dp[i - 1] + W[i - 2], dp[i - 2] + W[i - 1]); } ans[1] = dp[N - 1]; 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...