#include "stations.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
// #define int long long
const int N=1e3+100;
vector<int> ma[N];
vector<int> labels;
void dfs(int x,int v,int p)
{
labels[x]=v;
for(auto y:ma[x])
{
if(y==p)continue;
dfs(y,(v*8ll)+y,x);
}
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
labels.resize(n,0);
for(int i=0;i<(n);i++)ma[i].clear(),labels[i]=i;
for(int i=0;i<(n-1);i++)
{
ma[u[i]].push_back(v[i]);
ma[v[i]].push_back(u[i]);
}
dfs(0,0,-1);
return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
int last=t;
while(t>0)
{
t=t/8;
if(t==s)
return last;
last=t;
}
return (s/8);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
344 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=25953 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
344 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=23, label=1455 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
344 KB |
Invalid labels (values out of range). scenario=1, k=1000000, vertex=1, label=913163417 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
602 ms |
684 KB |
Output is correct |
2 |
Correct |
457 ms |
684 KB |
Output is correct |
3 |
Correct |
365 ms |
684 KB |
Output is correct |
4 |
Correct |
1 ms |
768 KB |
Output is correct |
5 |
Correct |
4 ms |
1020 KB |
Output is correct |
6 |
Correct |
0 ms |
768 KB |
Output is correct |
7 |
Correct |
383 ms |
684 KB |
Output is correct |
8 |
Correct |
519 ms |
684 KB |
Output is correct |
9 |
Correct |
425 ms |
684 KB |
Output is correct |
10 |
Correct |
381 ms |
684 KB |
Output is correct |
11 |
Correct |
2 ms |
768 KB |
Output is correct |
12 |
Correct |
3 ms |
764 KB |
Output is correct |
13 |
Correct |
3 ms |
768 KB |
Output is correct |
14 |
Correct |
2 ms |
768 KB |
Output is correct |
15 |
Correct |
1 ms |
768 KB |
Output is correct |
16 |
Correct |
333 ms |
684 KB |
Output is correct |
17 |
Correct |
343 ms |
684 KB |
Output is correct |
18 |
Correct |
327 ms |
684 KB |
Output is correct |
19 |
Correct |
321 ms |
688 KB |
Output is correct |
20 |
Correct |
357 ms |
684 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Invalid labels (values out of range). scenario=1, k=1000000000, vertex=1, label=-1644098759 |
2 |
Halted |
0 ms |
0 KB |
- |