Submission #200410

#TimeUsernameProblemLanguageResultExecution timeMemory
200410DavidDamianCrocodile's Underground City (IOI11_crocodile)C++11
46 / 100
186 ms262148 KiB
#include "crocodile.h" #include<bits/stdc++.h> using namespace std; struct edge{ int to; int w; }; vector<edge> adjList[1005]; #define INF INT_MAX int secondBest(int u,int p) { if(adjList[u].size()==1) return 0; int a=INF,b=INF; for(edge e: adjList[u]){ int v=e.to; if(v==p) continue; int dist=secondBest(v,u); if(dist+e.w<a){ b=a; a=dist+e.w; } else if(dist+e.w<b){ b=dist+e.w; } } return b; } int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { for(int i=0;i<M;i++){ int u=R[i][0]; int v=R[i][1]; edge e={v,L[i]}; adjList[u].push_back(e); e.to=u; adjList[v].push_back(e); } int dist=secondBest(0,-1); return dist; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...