#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 = 1;
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 |
Execution timed out |
3085 ms |
636444 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3161 ms |
1700624 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3054 ms |
320 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Invalid labels (duplicates values). scenario=1, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3057 ms |
36668 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |