#include "stations.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define F first
#define S second
int aqui,m=1e9,M=-1,cont;
vector<int> adj[1000],l(1000);
bool mk[1000];
void dfs(int x){
mk[x]=1;
l[x]=cont;
cont++;
for(auto y:adj[x])if(!mk[y])dfs(y);
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
for (int i = 0; i < n-1; i++) {
adj[u[i]].pb(v[i]);
adj[v[i]].pb(u[i]);
}
l.resize(n);
for(int i=0;i<n;i++)if(adj[i].size()==1){aqui=i; break;}
dfs(aqui);
for(auto x:l)cout<<x<<" ";
cout<<"\n";
return l;
}
int find_next_station(int s, int t, std::vector<int> c) {
if(t>s){for(auto x:c)M=max(M,x); return M;}
else {for(auto x:c)m=min(m,x); return m;}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
200 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
296 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
200 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
200 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
200 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |