# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1116581 | PagodePaiva | Road Closures (APIO21_roads) | C++17 | 24 ms | 4808 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<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;
int 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);
# | 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... |