Submission #1089267

#TimeUsernameProblemLanguageResultExecution timeMemory
1089267T0p_Stations (IOI20_stations)C++14
0 / 100
3090 ms2097152 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; const int N = 1000; int degree[N]; vector<int> g[N], labels; void dfs(int u, int p, int l) { labels[u] = l; for (int v : g[u]) { if (v == p) { continue; } dfs(v, u, l+1); } } vector<int> label(int n, int k, vector<int> u, vector<int> v) { labels = vector<int>(n); for (int i=0 ; i<n-1 ; i++) { g[u[i]].push_back(v[i]); g[v[i]].push_back(u[i]); degree[u[i]]++; degree[v[i]]++; } for (int i=0 ; i<n ; i++) { if (degree[i] == 1) { dfs(i, -1, 0); break; } } return labels; } int find_next_station(int s, int t, vector<int> c) { return s < t ? c[1] : 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...