Submission #590732

#TimeUsernameProblemLanguageResultExecution timeMemory
590732promaStations (IOI20_stations)C++17
0 / 100
3103 ms2097152 KiB
#include "stations.h" #include <vector> #include <bits/stdc++.h> using namespace std; vector <int> g[1005]; void dfs(int v, int p, int lab, vector <int> &labels) { labels[v] = lab ++; for (auto i: g[v]) { if (i != p) dfs(i, v, lab, labels); } } vector<int> label(int n, int k, vector<int> u, vector<int> v) { vector<int> labels(n), deg(n); for (int i = 0; i < n - 1; i ++) { deg[u[i]] ++; deg[v[i]] ++; g[u[i]].push_back(v[i]); g[v[i]].push_back(u[i]); } for (int i = 0; i < n; i ++) { if (deg[i] == 1) { dfs(i, -1, 0, labels); break; } }/* for (auto i: labels) { cout << i << " "; } cout << endl;*/ return labels; } int find_next_station(int s, int t, vector<int> c) { if (c.size() == 1) return c[0]; if (s < t) return c[1]; 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...