Submission #68119

#TimeUsernameProblemLanguageResultExecution timeMemory
68119KieranHorganCrocodile's Underground City (IOI11_crocodile)C++17
46 / 100
9 ms3360 KiB
#include "crocodile.h" #include <bits/stdc++.h> using namespace std; int k; vector<pair<int, int>> AdjList[100005]; bitset<100005> visited; int p[100005]; int dfs(int u) { if(p[u]) return 0; visited[u] = 1; vector<int> pos = {1<<30, 1<<30}; for(auto v: AdjList[u]) if(!visited[v.second]) pos.push_back(dfs(v.second)+v.first); sort(pos.begin(), pos.end()); return pos[1]; } int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { k = K; for(int i = 0; i < K; i++) p[P[i]]=1; for(int i = 0; i < M; i++) { AdjList[R[i][0]].push_back({L[i], R[i][1]}); AdjList[R[i][1]].push_back({L[i], R[i][0]}); } return dfs(0); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...