#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()==1){
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 |
Correct |
769 ms |
504 KB |
Output is correct |
2 |
Correct |
615 ms |
528 KB |
Output is correct |
3 |
Correct |
1146 ms |
456 KB |
Output is correct |
4 |
Correct |
640 ms |
588 KB |
Output is correct |
5 |
Correct |
660 ms |
400 KB |
Output is correct |
6 |
Correct |
522 ms |
520 KB |
Output is correct |
7 |
Correct |
523 ms |
508 KB |
Output is correct |
8 |
Correct |
3 ms |
448 KB |
Output is correct |
9 |
Correct |
5 ms |
468 KB |
Output is correct |
10 |
Correct |
1 ms |
468 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
554 ms |
560 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
606 ms |
528 KB |
Output is correct |
2 |
Correct |
545 ms |
516 KB |
Output is correct |
3 |
Correct |
1174 ms |
400 KB |
Output is correct |
4 |
Correct |
717 ms |
404 KB |
Output is correct |
5 |
Correct |
623 ms |
600 KB |
Output is correct |
6 |
Correct |
513 ms |
528 KB |
Output is correct |
7 |
Correct |
523 ms |
524 KB |
Output is correct |
8 |
Correct |
3 ms |
468 KB |
Output is correct |
9 |
Correct |
4 ms |
468 KB |
Output is correct |
10 |
Correct |
2 ms |
468 KB |
Output is correct |
11 |
Incorrect |
695 ms |
528 KB |
Wrong query response. |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
933 ms |
400 KB |
Output is correct |
2 |
Correct |
624 ms |
400 KB |
Output is correct |
3 |
Correct |
603 ms |
524 KB |
Output is correct |
4 |
Correct |
2 ms |
472 KB |
Output is correct |
5 |
Correct |
5 ms |
468 KB |
Output is correct |
6 |
Correct |
2 ms |
476 KB |
Output is correct |
7 |
Incorrect |
636 ms |
400 KB |
Wrong query response. |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
665 ms |
512 KB |
Output is correct |
2 |
Correct |
493 ms |
508 KB |
Output is correct |
3 |
Correct |
1093 ms |
400 KB |
Output is correct |
4 |
Correct |
751 ms |
400 KB |
Output is correct |
5 |
Correct |
704 ms |
400 KB |
Output is correct |
6 |
Correct |
562 ms |
508 KB |
Output is correct |
7 |
Correct |
426 ms |
508 KB |
Output is correct |
8 |
Correct |
3 ms |
476 KB |
Output is correct |
9 |
Correct |
5 ms |
468 KB |
Output is correct |
10 |
Correct |
1 ms |
468 KB |
Output is correct |
11 |
Incorrect |
594 ms |
528 KB |
Wrong query response. |
12 |
Halted |
0 ms |
0 KB |
- |