#include "stations.h"
#include <vector>
using namespace std;
vector < int > Next[1005];
int con[1005]={0};
int ans[1005]={0};
bool use[1005]={0};
void F(int here,int con)
{
ans[here]=con;
use[here]=1;
for(auto i:Next[here])
{
if(!use[i]) F(i,con+1);
}
}
vector<int> label(int n, int k, vector<int> u, vector<int> v)
{
vector<int> labels;
int i;
for(i=0;i<n;i++) labels.push_back(0);
for(int i=0;i<n-1;i++)
{
con[u[i]]++;
con[v[i]]++;
Next[u[i]].push_back(v[i]);
Next[v[i]].push_back(u[i]);
}
for(i=0;i<n;i++)
{
if(con[i]==1)
{
F(i,0);
break;
}
}
for(i=0;i<n;i++) labels[i]=ans[i];
return labels;
}
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 |
4 ms |
496 KB |
Invalid labels (duplicates values). scenario=2, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
508 KB |
Invalid labels (duplicates values). scenario=0, label=10 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
512 KB |
Invalid labels (duplicates values). scenario=1, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
911 ms |
768 KB |
Output is correct |
2 |
Incorrect |
652 ms |
888 KB |
Wrong query response. |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
512 KB |
Invalid labels (duplicates values). scenario=1, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |