# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
926215 | velislavgarkov | Stations (IOI20_stations) | C++14 | 3043 ms | 2097152 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 <iostream>
#include <algorithm>
#include <vector>
using namespace std;
const int MAXN=1e3+10;
vector <int> ver[MAXN];
vector <int> in;
int br;
void dfs(int x, int par) {
in[x]=br;
br++;
for (auto i:ver[x]) {
if (i==par) continue;
dfs(i,x);
}
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
in.resize(n);
for (int i=0;i<n-1;i++) {
ver[u[i]].push_back(v[i]);
ver[v[i]].push_back(u[i]);
}
dfs(0,-1);
return in;
}
int find_next_station(int s, int t, vector<int> c) {
sort(c.begin(),c.end());
if (s>t) return c[0];
int ans=c[0];
for (int i=1;i<c.size();i++) {
if (t>c[i]) ans=c[i];
}
return ans;
}
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... |