#include "stations.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
const int N=1e3+100;
vector<int> ma[N];
vector<int> labels;
void dfs(int x,int v,int p)
{
labels[x]=v;
for(auto y:ma[x])
{
if(y==p)continue;
dfs(y,v+1,x);
}
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
labels.resize(n,0);
for(int i=0;i<(n-1);i++)
{
ma[u[i]].push_back(v[i]);
ma[v[i]].push_back(u[i]);
}
for(int i=0;i<n;i++)
{
if(ma[i].size()==1)
{
dfs(i,0,-1);
}
}
return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
return *max_element(begin(c),end(c));
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1797 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3054 ms |
344 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1764 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
634 ms |
684 KB |
Output is correct |
2 |
Incorrect |
482 ms |
684 KB |
Wrong query response. |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3037 ms |
2097152 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |