#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
#define what_is(a) cout << #a << " is " << a << "\n"
#define checker(a) cout << "checker reached " << a << "\n"
vector<vector<int>> adj(1000,vector<int>());
vector<int> path;
void dfs(int u,int p){
path.push_back(u);
for(int v:adj[u])
if(v!=p)dfs(v,u);
//what_is(u);
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
vector<int> labels;
int counts[n];
memset(counts,0,sizeof(counts));
for(int i=0;i<n-1;i++){
adj[u[i]].push_back(v[i]);
adj[v[i]].push_back(u[i]);
counts[u[i]]++,counts[v[i]]++;
}
int start = 0;
for(int i=0;i<n;i++){
if(counts[i]==1){
start = i;
break;
}
}
dfs(start,-1);
labels.assign(n,0);
for(int i=0;i<n;i++)
labels[path[i]] = i;
return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
if(s<=t)
return max(c[0],c[1]);
else
return min(c[0],c[1]);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2250 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
967 ms |
406488 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1804 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
901 ms |
400 KB |
Output is correct |
2 |
Runtime error |
1482 ms |
2097156 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3026 ms |
2097156 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |