Submission #896506

#TimeUsernameProblemLanguageResultExecution timeMemory
896506LCJLYCrocodile's Underground City (IOI11_crocodile)C++14
46 / 100
166 ms262144 KiB
#include <bits/stdc++.h> #include "crocodile.h" using namespace std; typedef pair<int,int>pii; vector<pii>adj[100005]; int dfs(int index, int par){ vector<int>v; for(auto it:adj[index]){ if(it.first==par) continue; v.push_back(dfs(it.first,index)+it.second); } sort(v.begin(),v.end()); if(v.size()>=2){ return v[1]; } else return 0; } int travel_plan(int n, int m, int r[][2], int w[], int k, int p[]){ for(int x=0;x<m;x++){ adj[r[x][0]].push_back({r[x][1],w[x]}); adj[r[x][1]].push_back({r[x][0],w[x]}); } return dfs(0,-1); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...