# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
319912 | knon0501 | 악어의 지하 도시 (IOI11_crocodile) | C++14 | 194 ms | 262148 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;
int n;
vector<pair<int,int>> a[100001];
long long dp[100001];
int chk[100001];
long long dfs(int v,int p){
if(chk[v])return dp[v]=0;
vector<long long> b;
for(auto u: a[v]){
if(u.first==p)continue;
b.push_back(dfs(u.first,v)+u.second);
}
sort(b.begin(),b.end());
return dp[v]=b[1];
}
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
n=N;
int i,j;
for(i=0 ; i<K ; i++)chk[P[i]]=1;
for(i=0 ; i<M ; i++){
int u=R[i][0];
int v=R[i][1];
a[u].push_back({v,L[i]});
a[v].push_back({u,L[i]});
}
dfs(0,-1);
return dp[0];
}
컴파일 시 표준 에러 (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... |