# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
568181 | aryan12 | Road Closures (APIO21_roads) | C++17 | 76 ms | 9172 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 <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
vector<array<long long, 2> > g[MAXN];
vector<long long> minimum_closure_costs(int N, vector<int> U, vector<int> V, vector<int> W)
{
// sort(W.begin(), W.end());
long long sum = 0;
vector<long long> ans;
for(long long i = 0; i < W.size(); i++)
{
sum += (long long)W[i];
}
// for(long long i = W.size() - 1; i >= 0; i--)
// {
// // ans.push_back(sum);
// sum -= W[i];
// }
ans.push_back(sum);
vector<long long> dp(N, 1e15);
dp[0] = 0;
dp[1] = W[0];
for(int i = 2; i < N; i++)
{
dp[i] = min(dp[i - 1], dp[i - 2]) + W[i - 1];
}
ans.push_back(min(dp[N - 1], dp[N - 2]));
for(int i = 2; i < N; i++)
{
ans.push_back(0);
}
return ans;
}
// std::vector<long long> minimum_closure_costs(int N, std::vector<int> U,
// std::vector<int> V,
// std::vector<int> W) {
// return std::vector<long long>(N, 0);
// }
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... |