# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
592168 | PiejanVDC | Stations (IOI20_stations) | C++17 | 0 ms | 0 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>label(int n, int k, vectro<int>u, vector<int>v) {
vector<int>adj[n];
for(int i = 0 ; i < (int)u.size() ; i++) {
adj[u[i]].push_back(v[i]);
adj[v[i]].push_back(u[i]);
}
int start;
for(int i = 0 ; i < n ; i++) {
if((int)adj[i].size() == 1)
start = i;
}
vector<int>l(n);
vectro<bool>vis(n, 0);
for(int i = 0 ; i < n ; i++) {
vis[start] = 1;
l[start] = i;
for(auto z : adj[start]) if(!vis[z])
start = z;
}
return l;
}
int find_next_station(int s, int t, vector<int>c) {
if(s < t)
return c[1];
return c[0];
}