#include "stations.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
typedef pair<ll,ll> pii;
const ll MAXN = 2e5+5;
const ll INF = 1e9+7;
vector<vector<ll>>adj(MAXN);
int deg[MAXN],order[MAXN];
void dfs(int node, int p,int mark){
order[node]=mark;
for(auto u:adj[node]){
if(u==p)continue;
dfs(u,node,mark+1);
}
}
std::vector<int> label(int n, int k,std::vector<int>u,std::vector<int>v){
std::vector<int> labels(n);
int i;
for(i=0;i<n-1;i++){
adj[u[i]].pb(v[i]);
adj[v[i]].pb(u[i]);
deg[u[i]]++;
deg[v[i]]++;
}
for(i=0;i<n;i++) {
if(deg[i]==1)break;
}
dfs(i,-1,0);
for (i = 0; i < n; i++) {
labels[i] = order[i];
}
return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
sort(c.begin(),c.end());
if(t<s)return c[0];
return c[c.size()-1];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2714 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3080 ms |
5108 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2021 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
950 ms |
9920 KB |
Output is correct |
2 |
Incorrect |
731 ms |
9872 KB |
Wrong query response. |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3170 ms |
1537636 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |