#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 = 1005;
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;
}
// cout<<i<<" k \n";
dfs(i,-1,0);
for (i = 0; i < n; i++) {
labels[i] = order[i];
// cout<<order[i]<<" ";
}//cout<<endl;
return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
int mini=INF,maxi=-1;
for(auto u:c){
mini=min(mini,u);
maxi=max(maxi,u);
}
// sort(c.begin(),c.end());
if(t<s)return mini;
return maxi;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2463 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3062 ms |
404 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2138 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
909 ms |
648 KB |
Output is correct |
2 |
Incorrect |
654 ms |
460 KB |
Wrong query response. |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3138 ms |
1506488 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |