# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
306080 | eriksuenderhauf | Stations (IOI20_stations) | C++17 | 1047 ms | 1280 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
vector<int> deg(n);
vector<vector<int>> adj(n);
for (int i = 0; i < n - 1; i++)
deg[u[i]]++, deg[v[i]]++, adj[u[i]].push_back(v[i]), adj[v[i]].push_back(u[i]);;
vector<int> labels(n);
function<void(int,int)> init = [&](int u, int p) {
if (~p) adj[u].erase(find(adj[u].begin(), adj[u].end(), p));
for (int v: adj[u])
init(v, u);
};
init(0, -1);
// function<void(int,int)> dfs;
// function<void(int,int,int,int)> join = [&](int u, int l, int r, int v) {
// if (l > r) return;
// if (l == r)
// dfs(adj[u][l], 2*v+1);
// else {
// int m = (l+r) / 2;
// join(u, l, m, v*2+1);
// join(u, m+1, r, v*2+2);
// }
// };
// dfs = [&](int u, int l) {
// labels[u] = l;
// join(u, 0, adj[u].size()-1, l);
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |