제출 #976417

#제출 시각아이디문제언어결과실행 시간메모리
976417josanneo22도로 폐쇄 (APIO21_roads)C++17
7 / 100
32 ms6488 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); for (int i = 0; i < N - 1; i++) { i64 take = (i == 0 ? 0 : dp[i - 1]) + W[i]; i64 dun_take = (i - 2 < 0 ? 0 : dp[i - 2]) + (i - 1 < 0 ? 0 : W[i - 1]); dp[i] = min(take, dun_take); } ans[1] = dp[N - 2]; 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...