Submission #618877

#TimeUsernameProblemLanguageResultExecution timeMemory
618877Mohammed_AtalahCrocodile's Underground City (IOI11_crocodile)C++17
46 / 100
5 ms2004 KiB
#include "crocodile.h" #include <bits/stdc++.h> using namespace std; vector<vector<vector<int>>> edg; map<int, int> mp; vector<int> vis; int dfs(int idx) { vector<int> v; for (auto &i : edg[idx]) { if (!vis[i[0]]) { vis[i[0]] = 1; int e = i[1]; if (!mp[i[0]]) { e += dfs(i[0]); } v.push_back(e); } } sort(v.begin(), v.end()); return v[1]; } int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { edg.resize(N); vis.resize(N); for (int i = 0; i < M; i++) { edg[R[i][0]].push_back({R[i][1], L[i]}); edg[R[i][1]].push_back({R[i][0], L[i]}); } for (int i = 0; i < K ; i++) { mp[P[i]]++; } vis[0] = 1; return dfs(0); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...