| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1367838 | sukritp5 | 도로 폐쇄 (APIO21_roads) | C++20 | 20 ms | 4916 KiB |
#include "roads.h"
#include <bits/stdc++.h>
using namespace std;
const int MXN=1e5+7;
long long dp[MXN][2];
vector<long long> minimum_closure_costs(int n, vector<int> u,
vector<int> v,vector<int> w) {
vector<long long> ret(n);
long long sum=0;
for(auto x:w)sum+=x;
ret[0]=sum;
// 1 is here 0 is not
for(int i=1;i<n;i++){
dp[i][1]=dp[i-1][0]+w[i-1];
dp[i][0]=max(dp[i-1][0],dp[i-1][1]);
}
ret[1]=(sum-max(dp[n-1][0],dp[n-1][1]));
for(int k=2;k<n;k++)ret[k]=0LL;
return ret;
}
| # | 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... | ||||
