#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<int> path;
void dfs(int u,int p,vector<vector<int>>& adj){
path.push_back(u);
for(int v:adj[u])
if(v!=p)dfs(v,u,adj);
//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];
vector<vector<int>> adj(1000,vector<int>());
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;
}
}
path.clear();
dfs(start,-1,adj);
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(c.size()!=2)while(true);
if(s<=t)
return max(c[0],c[1]);
else
return min(c[0],c[1]);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3048 ms |
580 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3052 ms |
592 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3040 ms |
612 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3052 ms |
528 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3032 ms |
612 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |