# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
578519 | Vanilla | Stations (IOI20_stations) | C++17 | 755 ms | 536 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 <bits/stdc++.h>
#include "stations.h"
using namespace std;
const int maxn = 1002;
vector <int> ad [maxn];
int ct = 0;
void dfs (int u, int p, vector <int> &lb) {
lb[u] = ct++;
for (int v: ad[u]) {
if (v == p) continue;
dfs(v, u, lb);
}
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
vector<int> labels(n);
for (int i = 0; i < n; i++){
ad[i].clear();
}
for (int i = 0; i < n - 1; i++){
ad[u[i]].push_back(v[i]);
ad[v[i]].push_back(u[i]);
}
dfs(0, -1, labels);
return labels;
}
int find_next_station(int s, int t, vector<int> c) {
if (t <= c[0]) return c[0];
for (int i = 1; i < c.size(); i++){
if (c[i] == t) return c[i];
if (c[i] > t) return c[i-1];
}
return -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... |