Submission #372918

#TimeUsernameProblemLanguageResultExecution timeMemory
372918Jarif_RahmanStations (IOI20_stations)C++17
0 / 100
6 ms1364 KiB
#include "stations.h" #include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; int n; vector<vector<int>> v; vector<int> label(int nn, int k, vector<int> aa, vector<int> bb){ n = nn; v.assign(n, {}); for(int i = 0; i < n-1; i++){ v[aa[i]].pb(bb[i]); v[bb[i]].pb(aa[i]); } vector<int> lb(n); for(int i = 0; i < n; i++) lb[i] = i; return lb; } vector<int> cur; int ans; void dfs(int nd, int ss, int tt){ if(nd == tt){ ans = cur.front(); return; } if(ans != -1) return; for(int x: v[nd]) if(x!=ss){ cur.pb(x); dfs(x, nd, tt); cur.pop_back(); } } int find_next_station(int s, int t, vector<int> c){ cur.clear(); ans = -1; dfs(s, -1, t); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...