#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> G[1001];
int tin[1001];
int tout[1001];
int level[1001];
int T;
void dfs(int v,int p = -1){
if(p != -1) level[v] = level[p]+1;
tin[v] = T++;
for(auto e:G[v]){
if(e == p) continue;
dfs(e,v);
}
tout[v] = T;
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
T = 0;
for (int i = 0; i < n; ++i)
{
G[i].clear();
}
for (int i = 0; i < n-1; ++i)
{
G[u[i]].push_back(v[i]);
G[v[i]].push_back(u[i]);
}
int root = 0;
while(G[root].size() != 1) root++;
dfs(root);
vector<int> labels;
for (int i = 0; i < n; ++i)
{
labels.push_back(tin[i]);
}
return labels;
}
int find_next_station(int s, int t, vector<int> c) {
sort(c.begin(), c.end());
if(t > s) return c.back();
else return c[0];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
415 ms |
532 KB |
Output is correct |
2 |
Correct |
311 ms |
548 KB |
Output is correct |
3 |
Correct |
682 ms |
536 KB |
Output is correct |
4 |
Correct |
507 ms |
544 KB |
Output is correct |
5 |
Correct |
534 ms |
416 KB |
Output is correct |
6 |
Correct |
380 ms |
772 KB |
Output is correct |
7 |
Correct |
416 ms |
532 KB |
Output is correct |
8 |
Correct |
2 ms |
620 KB |
Output is correct |
9 |
Correct |
4 ms |
624 KB |
Output is correct |
10 |
Correct |
0 ms |
624 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
404 ms |
540 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
445 ms |
532 KB |
Output is correct |
2 |
Correct |
434 ms |
628 KB |
Output is correct |
3 |
Correct |
639 ms |
520 KB |
Output is correct |
4 |
Correct |
466 ms |
612 KB |
Output is correct |
5 |
Correct |
449 ms |
536 KB |
Output is correct |
6 |
Correct |
361 ms |
544 KB |
Output is correct |
7 |
Correct |
330 ms |
524 KB |
Output is correct |
8 |
Correct |
1 ms |
632 KB |
Output is correct |
9 |
Correct |
3 ms |
620 KB |
Output is correct |
10 |
Correct |
0 ms |
492 KB |
Output is correct |
11 |
Incorrect |
442 ms |
532 KB |
Wrong query response. |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
569 ms |
544 KB |
Output is correct |
2 |
Correct |
520 ms |
548 KB |
Output is correct |
3 |
Correct |
459 ms |
556 KB |
Output is correct |
4 |
Correct |
1 ms |
620 KB |
Output is correct |
5 |
Correct |
4 ms |
492 KB |
Output is correct |
6 |
Correct |
0 ms |
500 KB |
Output is correct |
7 |
Incorrect |
472 ms |
548 KB |
Wrong query response. |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
471 ms |
544 KB |
Output is correct |
2 |
Correct |
415 ms |
540 KB |
Output is correct |
3 |
Correct |
758 ms |
536 KB |
Output is correct |
4 |
Correct |
556 ms |
544 KB |
Output is correct |
5 |
Correct |
447 ms |
416 KB |
Output is correct |
6 |
Correct |
367 ms |
552 KB |
Output is correct |
7 |
Correct |
312 ms |
552 KB |
Output is correct |
8 |
Correct |
1 ms |
492 KB |
Output is correct |
9 |
Correct |
3 ms |
556 KB |
Output is correct |
10 |
Correct |
0 ms |
620 KB |
Output is correct |
11 |
Incorrect |
386 ms |
532 KB |
Wrong query response. |
12 |
Halted |
0 ms |
0 KB |
- |