# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
838277 | puppy | Stations (IOI20_stations) | C++17 | 625 ms | 676 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 <vector>
#include <functional>
#include <algorithm>
using namespace std;
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
vector<vector<int>> adj(n);
for (int i = 0; i < n-1; i++) {
adj[u[i]].push_back(v[i]);
adj[v[i]].push_back(u[i]);
}
vector<int> id(n);
int ord = 0;
function<void(int, int, int)> dfs = [&](int v, int p, int depth)
{
if (depth % 2 == 0) id[v] = ord++;
for (int i:adj[v]) {
if (i != p) dfs(i, v, depth + 1);
}
if (depth % 2 == 1) id[v] = ord++;
};
dfs(0, -1, 0);
return id;
}
int find_next_station(int s, int t, std::vector<int> c) {
int parity = -1;
if (c[0] > s) parity = 0;
else parity = 1;
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... |