#include "stations.h"
#include <vector>
using namespace std;
const int N = 1e3;
const int inf = 1e9;
vector <int> e[N];
vector<int> labels;
int cnt = 0;
void dfs(int node, int p){
for(auto i:e[node]){
if(i == p)continue;
dfs(i, node);
}
labels[node] = cnt++;
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
labels.resize(n);
for(int i = 0;i < n - 1;i++){
e[u[i]].push_back(v[i]);
e[v[i]].push_back(u[i]);
}
dfs(0, -1);
return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
if(s < t){
///s go up
int mx = -1;
for(auto i:c){
mx = max(mx,i);
}
return mx;
}else{
///s go down?
int mn = inf;
for(auto i:c){
if(i < mn && t <= i){
mn = i;
}
}
return mn;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2846 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3045 ms |
336 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1921 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
776 ms |
668 KB |
Output is correct |
2 |
Runtime error |
1816 ms |
2097152 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3107 ms |
2097152 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |