Submission #563779

#TimeUsernameProblemLanguageResultExecution timeMemory
563779Leo121Stations (IOI20_stations)C++14
0 / 100
3143 ms2097152 KiB
#include "stations.h" #include <bits/stdc++.h> #include <vector> #define forn(i, a, b) for(int i = int(a); i <= int(b); ++ i) #define for0(i, n) for(int i = 0; i < int(n); ++ i) #define for1(i, n) for(int i = 1; i <= int(n); ++ i) #define pb push_back using namespace std; typedef vector<int> vi; const int maxn = 1e3; vi tree[maxn]; vi num; int mayor[maxn]; int cnt; void dfs(int u, int p, bool aux){ if(!aux){ num[u] = ++ cnt; } for(auto v : tree[u]){ if(v == p){ continue; } dfs(v, u, aux ^ 1); mayor[u] = mayor[v]; } if(aux){ num[u] = ++ cnt; } } std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { num.clear(); num.resize(n); for0(i, maxn){ tree[i].clear(); } for0(i, n){ tree[u[i]].pb(v[i]); tree[v[i]].pb(u[i]); } cnt = -1; dfs(0, 0, 0); return num; } int find_next_station(int s, int t, std::vector<int> c) { return c[0]; }
#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...