Submission #568193

#TimeUsernameProblemLanguageResultExecution timeMemory
568193n0sk1llCrocodile's Underground City (IOI11_crocodile)C++17
46 / 100
146 ms262144 KiB
#include "crocodile.h" #include <bits/stdc++.h> #define xx first #define yy second using namespace std; long long int typedef li; vector<vector<pair<int,int>>> g(100003); li dp[100003]; void dfs(int p, int q) { if (g[p].size()==1) return; vector<li> vals; for (auto it : g[p]) if (it.yy!=q) { dfs(it.yy,p); vals.push_back(dp[it.yy]+it.xx); } sort(vals.begin(),vals.end()); dp[p]=vals[1]; } 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({L[i],R[i][1]}); g[R[i][1]].push_back({L[i],R[i][0]}); } dfs(0,-1); return dp[0]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...