#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool visited[1001];
vector<int> a, adj[1001];
int curr;
void dfs(int x=0) {
visited[x]=1;
a[x]=curr++;
for(auto i: adj[x]) if(!visited[i]) dfs(i);
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
curr=0;
a.resize(n);
memset(visited, 0, sizeof(visited));
for(int i=0; i<1001; i++) adj[i].clear();
for(int i=0; i<n-1; i++) {
adj[u[i]].push_back(v[i]);
adj[v[i]].push_back(u[i]);
}
dfs();
return a;
}
int find_next_station(int s, int t, std::vector<int> c) {
return c[lower_bound(c.begin(), c.end(), t)-c.begin()];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
478 ms |
544 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
436 ms |
548 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
505 ms |
536 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
873 ms |
524 KB |
Output is correct |
2 |
Incorrect |
570 ms |
528 KB |
Wrong query response. |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
440 ms |
516 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |