#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);
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
for(int i=0;i<n;i++)
adj[i] = vector<int>();
for(int i=0;i<n-1;i++){
adj[u[i]].push_back(v[i]);
adj[v[i]].push_back(u[i]);
}
int start = 0;
for(int i=0;i<n;i++)
if(adj[i].size()==0){
start = i;
break;
}
path.clear();
dfs(start,start);
vector<int> lbl(n);
for(int i=0;i<n;i++)
lbl[path[i]] = i;
return lbl;
}
int find_next_station(int s, int t, std::vector<int> c) {
if(c.size()==1)return c[0];
if(s<t)
return c[1];
else
return c[0];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
667 ms |
596 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
515 ms |
528 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
514 ms |
508 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1031 ms |
508 KB |
Output is correct |
2 |
Incorrect |
741 ms |
412 KB |
Wrong query response. |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
534 ms |
520 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |