# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
569832 | Lobo | Road Closures (APIO21_roads) | C++17 | 76 ms | 16716 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "roads.h"
#include<bits/stdc++.h>
using namespace std;
const long long inf = (long long) 1e18 + 10;
const int inf1 = (int) 1e9 + 10;
#define int long long
#define dbl long double
#define endl '\n'
#define sc second
#define fr first
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
const int maxn = 2e5+10;
int n;
vector<pair<int,int>> g[maxn];
int dp[maxn][2], mark[maxn][2];
//fl = 1 -> o anterior ta usado
int sol(int u, int fl) {
if(mark[u][fl]) return dp[u][fl];
dp[u][fl] = inf;
mark[u][fl] = 1;
if(u == n) {
return dp[u][fl] = 0;
}
int v = u+1;
int w;
for(auto V : g[u]) if(V.fr == v) {
w = V.sc;
}
if(fl) dp[u][fl] = min(dp[u][fl],sol(v,0));
dp[u][fl] = min(dp[u][fl], w+sol(v,1));
return dp[u][fl];
}
vector<int> minimum_closure_costs(int32_t N, vector<int32_t> U, vector<int32_t> V, vector<int32_t> W) {
n = N;
int sm = 0;
vector<int> vc;
for(int i = 0; i < n-1; i++) {
g[U[i]+1].pb(mp(V[i]+1,W[i]));
g[V[i]+1].pb(mp(U[i]+1,W[i]));
vc.pb(W[i]);
sm+= vc.back();
}
vector<int> ans;
ans.pb(sm);
sort(all(vc),greater<int>());
for(int i = 0; i <= n-2; i++) {
sm-= vc[i];
ans.pb(sm);
}
return ans;
}
컴파일 시 표준 에러 (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... |