# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
780763 | Josia | Stations (IOI20_stations) | C++17 | 727 ms | 628 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> pre;
vector<vector<int>> graph;
int tim;
void dfs(int v) {
if (pre[v] != -1) return;
pre[v] = tim++;
for (int i: graph[v]) {
dfs(i);
}
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
tim = 0;
vector<int> labels(n);
pre.assign(n, -1);
graph.clear(); graph.resize(n);
for (int i = 0; i<n-1; i++) {
graph[u[i]].push_back(v[i]);
graph[v[i]].push_back(u[i]);
}
dfs(0);
// for (int i: pre) cerr << i << " ";
// cerr << "\n";
return pre;
}
int find_next_station(int s, int t, vector<int> c) {
sort(c.begin(), c.end());
if (t < s) return c[0];
reverse(c.begin(), c.end());
for (int i = 0; i<c.size(); i++) {
if (t >= c[i]) return c[i];
}
assert(0);
}
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... |