# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
706506 | rafatoa | Stations (IOI20_stations) | C++17 | 901 ms | 760 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>
using namespace std;
vector<int> label(int n, int k, vector<int> u, vector<int> v){
vector<int> l(n);
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]);
}
int aux = 0;
function<void(int, int)> dfs = [&](int s, int e){
l[s] = aux++;
for(auto u:adj[s])
if(u != e) dfs(u, s);
};
dfs(0, -1);
return l;
}
int find_next_station(int s, int t, vector<int> c){
if(t < s){
for(auto &x:c)
if(x < s) return x;
} else {
int bst = 0;
for(auto &x:c)
if(x <= t) bst = max(bst, x);
return bst;
}
}
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... |