| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1367825 | fotonoinoi | Road Closures (APIO21_roads) | C++20 | 16 ms | 5252 KiB |
#include "roads.h"
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
vector<long long> minimum_closure_costs(int N,vector<int> U,vector<int> V,vector<int> W)
{
vector<long long> ans;
long long dist[N],sum=0,dp[N];
int x,y,w;
for(int i=0;i<N-1;i++)
{
x=U[i];
y=V[i];
w=W[i];
if(x>y)
swap(x,y);
sum+=w;
dist[y]=w;
}
dp[0]=0;
dp[1]=dist[1];
for(int i=2;i<N-1;i++)
{
dp[i]=min(dp[i-1],dp[i-2])+dist[i];
}
ans.push_back(sum);
ans.push_back(min(dp[N-1],dp[N-2]));
for(int i=2;i<N;i++)
{
ans.push_back(0);
}
return ans;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
