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;
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) begin(a),end(a)
using ll = long long;
using vi = vector<int>;
const int mxN = 1010;
vi labels;
int dfs_timer = 0;
vi adj[mxN];
void dfs(int s, int p){
labels[s] = dfs_timer++;
for(auto u : adj[s])
if(u!=p) dfs(u,s);
}
vi label(int n, int k, vi u, vi v) {
labels.resize(n,0); dfs_timer=0;
for(int i = 0; i < sz(u); i++){
int a = u[i], b = v[i];
adj[a].pb(b), adj[b].pb(a);
}
dfs(0,-1);
return labels;
}
int find_next_station(int s, int t, vi c) {
if(t < s) return c[0];
int pos = lower_bound(all(c),t)-begin(c)-1;
if(pos!=-1) return c[pos];
return c[0];
}
# | 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... |