#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1005;
int deg[N];
vector <int> g[N];
vector <int> label(int n,int k,vector <int> u,vector <int> v){
for(int i = 0; i < n-1; i++){
deg[u[i]]++, deg[v[i]]++;
g[u[i]].push_back(v[i]);
g[v[i]].push_back(u[i]);
}
bool prvi = 1;
for(int i = 0; i < n; i++) if(deg[i] > 2) prvi = 0;
if(prvi){
int cnt = 0;
vector <int> l(n);
queue <pair<int,int>> q;
for(int i = 0; i < n; i++){
if(deg[i] == 1){
q.push({i,0});
break;
}
}
while(!q.empty()){
int u = q.front().first,par = q.front().second;
l[u] = cnt++;
q.pop();
for(auto v : g[u]){
if(v == par) continue;
q.push({v,u});
}
}
return l;
}
assert(1 == 0);
}
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 |
Runtime error |
2 ms |
440 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
572 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
564 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
432 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
576 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |