#include <bits/stdc++.h>
using namespace std;
vector <int> path[1111];
stack <int> walk;
int pass[1111];
vector <int> la;
vector <int> label(int n, int k, vector<int> u, vector<int> v)
{
la.clear();
int i,x;
for(i=0;i<n;i++)
{
pass[i]=0;
la.push_back(0);
}
x=u.size();
for(i=0;i<x;i++)
{
path[u[i]].push_back(v[i]);
path[v[i]].push_back(u[i]);
}
for(i=0;i<n;i++)
{
if(path[i].size()==1)
{
walk.push(i);
break;
}
}
x=0;
while(!walk.empty())
{
i=walk.top();
walk.pop();
if(pass[i]==1) continue;
pass[i]=1;
la[i]=x;
x++;
for(auto a:path[i])
{
if(pass[a]==1) continue;
walk.push(a);
}
}
return la;
}
int find_next_station(int s, int t, vector<int> c)
{
if(s<t) return s+1;
else return s-1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
456 KB |
Invalid labels (duplicates values). scenario=1, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
448 KB |
Invalid labels (duplicates values). scenario=1, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
444 KB |
Invalid labels (duplicates values). scenario=2, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
312 KB |
Invalid labels (duplicates values). scenario=1, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
456 KB |
Invalid labels (duplicates values). scenario=2, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |