#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
template<class T, class U>
void ckmin(T &a, U b)
{
if (a > b) a = b;
}
template<class T, class U>
void ckmax(T &a, U b)
{
if (a < b) a = b;
}
#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--)
#define SZ(x) ((int) (x).size())
#define ALL(x) (x).begin(), (x).end()
const int MAXN = 1013;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
int N, K;
vi edge[MAXN];
vi ord, ans;
void dfs(int u, int p)
{
for (int v : edge[u])
{
if (v == p) continue;
dfs(v, u);
}
ord.PB(u);
}
vi label(int n, int k, vi U, vi V)
{
N = n; K = k;
FOR(i, 0, N)
{
edge[i].clear();
}
ord.clear(); ans.clear();
FOR(i, 0, N - 1)
{
int u = U[i], v = V[i];
edge[u].PB(v);
edge[v].PB(u);
}
dfs(0, N);
ans.resize(N);
FOR(i, 0, N)
{
ans[ord[i]] = i;
}
return ans;
}
int find_next_station(int s, int t, vi ch)
{
//you're at s and you want to go to t.
if (t < s)
{
//find the smallest guy >= t
int mn = 1e5 + 13;
for (int x : ch)
{
if (x > s || x < t) continue;
ckmin(mn, x);
}
return mn;
}
for (int x : ch)
{
if (x > s) return x;
}
assert(false);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
490 ms |
516 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
480 ms |
512 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
555 ms |
512 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
952 ms |
528 KB |
Output is correct |
2 |
Incorrect |
782 ms |
512 KB |
Wrong query response. |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
522 ms |
508 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |