제출 #821735

#제출 시각아이디문제언어결과실행 시간메모리
821735nemethm악어의 지하 도시 (IOI11_crocodile)C++17
0 / 100
2 ms2644 KiB
#include "crocodile.h" #include <bits/stdc++.h> using namespace std; using ll = long long int; vector<pair<int,ll>> g[100100]; ll dist[100100] = {0}; void dfs(int node, int prev = -1){ for(auto i : g[node]){ if(i.first != prev){ dist[i.first] = dist[node] + i.second; dfs(i.first, node); } } } int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { for(int i = 0; i < M; ++i){ g[R[i][0]].push_back({R[i][1], L[i]}); g[R[i][1]].push_back({R[i][0], L[i]}); } dfs(0); ll ans = 0; for(int i = 0; i < K; ++i){ ans = max(ans, dist[P[i]]); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...