# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
780985 | Blagoj | Stations (IOI20_stations) | C++17 | 611 ms | 548 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;
vector<int> g[1005], labels;
int in[1005], out[1005], timer = 0;
void dfs(int n, int p) {
labels[n] = timer++;
for (auto x : g[n]) if (x != p) dfs(x, n);
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
labels.resize(n, 0);
for (int i = 0; i < n; i++) g[i].clear();
timer = 0;
for (int i = 0; i < u.size(); i++) {
g[u[i]].push_back(v[i]);
g[v[i]].push_back(u[i]);
}
dfs(0, -1);
return labels;
}
int find_next_station(int s, int t, vector<int> c) {
int parent = -1;
for (auto x : c) {
if (x < s) {
parent = x;
continue;
}
if (min(x, s) < t && t < max(x, s)) return x;
}
return parent;
}
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... |