제출 #1116583

#제출 시각아이디문제언어결과실행 시간메모리
1116583PagodePaiva도로 폐쇄 (APIO21_roads)C++17
7 / 100
33 ms7624 KiB
#include<bits/stdc++.h> #include "roads.h" #include <vector> using namespace std; const int N = 100010; int v[N]; std::vector<long long> minimum_closure_costs(int n, std::vector<int> U, std::vector<int> V, std::vector<int> W) { long long res = 0; vector <long long> ans; long long pref[n+1]; int suf[n+1]; for(int i = 0;i <= n;i++){ pref[i] = suf[i] = 0; } long long sum = 0; for(int i = 0;i < n-1;i++){ v[i+1] = W[i]; sum += v[i+1]; } pref[1] = 0; for(int i = 2;i <= n-1;i++){ pref[i] = min(pref[i-1]+v[i], pref[i-2]+v[i-1]); } res = pref[n-1]; //vector <int> ans; ans.push_back(sum); ans.push_back(res); for(int i = 2;i <= n-1;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...