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"
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, s, n) for(ll i = ll(s); i < ll(n); i++)
#define rrep(i, n) for(ll i = ll(n)-1; i >= 0; i--)
#define pb push_back
#define eb emplace_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vp = vector<P>;
using vvp = vector<vp>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vs = vector<string>;
template<class T>
bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T>
bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
vi label(int n, int k, vi u, vi v) {
vvi G(n);
rep(i, n - 1) {
G[u[i]].pb(v[i]);
G[v[i]].pb(u[i]);
}
vi ls;
auto dfs = [&](auto &dfs, int now, int p) -> void {
ls.pb(now);
for (int nx : G[now]) {
if (nx == p) continue;
dfs(dfs, nx, now);
}
};
rep(i, n) if (G[i].size() == 1) {
dfs(dfs, i, -1);
break;
}
vi res(n);
rep(i, n) res[ls[i]] = i;
return res;
}
int find_next_station(int s, int t, vi c) {
for (int i : c) {
if (abs(s - i) + abs(t - i) == abs(s - t)) return i;
}
}
Compilation message (stderr)
stations.cpp: In function 'int find_next_station(int, int, vi)':
stations.cpp:68:1: warning: control reaches end of non-void function [-Wreturn-type]
68 | }
| ^
# | 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... |