#include "stations.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
vi labels;
labels.resize(n);
vector<vi>G;
G.resize(n+1);
for(int i=0;i<n;i++){
int x=u[i],y=v[i];
G[x].push_back(y);
G[y].push_back(x);
}
int vis[1010],no=0,id=-1;
for(int i=0;i<n;i++){
if(G[i].size()==1){
id=i;
break;
}
}
memset(vis,0,sizeof vis);
queue<int> q;
q.push(id);
while(!q.empty()){
int x=q.front();
//cout<<x<<endl;
q.pop();
vis[x]=1;
labels[x]=no;
no++;
for(auto &v:G[x]){
if(!vis[v]){
q.push(v);
}
}
}
return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
if(s>t)
return s-1;
return s+1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
7 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1010 ms |
644 KB |
Output is correct |
2 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |