#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e3 + 7;
void dfs( vector<vector<int>> adj, int v, int p, int h, vector<int> &lb, int &cnt ) {
cnt++;
for ( auto u: adj[v] ) {
if ( u != p ) {
dfs( adj, u, v, h + 1, lb, cnt );
}
}
lb[v] = cnt++;
}
vector<int> label(int n, int k, vector<int> U, vector<int> V) {
vector < vector < int > > adj(n + 1);
for ( int i = 0; i < n - 1; i++ ) {
int u = U[i], v = V[i];
adj[u].push_back(v);
adj[v].push_back(u);
}
vector < int > lb(n);
int cnt = 0;
dfs( adj, 0, -1, 0, lb, cnt );
return lb;
}
int find_next_station(int s, int t, vector<int> c) {
int pr = -1;
if ( c.back() > s ) {
pr = c.back();
c.pop_back();
}
// cout << tins << ' ' << touts << ' ' << pr << endl;
for ( auto u: c ) {
if ( t <= u) {
return u;
}
}
assert( pr != -1 );
return pr;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
297 ms |
55296 KB |
Invalid labels (values out of range). scenario=2, k=1000, vertex=0, label=1995 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
531 ms |
1020 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=1991 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
842 ms |
55468 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
903 ms |
520 KB |
Output is correct |
2 |
Correct |
641 ms |
400 KB |
Output is correct |
3 |
Incorrect |
557 ms |
400 KB |
Wrong query response. |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
818 ms |
55508 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |