#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> lbl;
void dfs(int u,int p,int d){
lbl[u] = d;
for(int i=0;i<(int)adj[u].size();i++)
if(adj[u][i]!=p)
dfs(adj[u][i],u,d*8+i+1);
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
lbl = vector<int>(n);
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]);
}
dfs(0,0,0);
return lbl;
}
int find_next_station(int s, int t, std::vector<int> c) {
int a =s,b=t;
while(a>0){
a= (a-1)/8;
if(a==b)break;
}
if(a==b)return (s-1)/8;
a=s,b=t;
int p=b;
while(b>0){
p=b;
b = (b-1)/8;
if(a==b)break;
}
if(a==b)return p;
return (s-1)/8;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
424 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=8842 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
312 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=23, label=1170 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
444 KB |
Invalid labels (values out of range). scenario=1, k=1000000, vertex=1, label=1380226186 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
919 ms |
400 KB |
Output is correct |
2 |
Correct |
852 ms |
528 KB |
Output is correct |
3 |
Correct |
650 ms |
512 KB |
Output is correct |
4 |
Correct |
3 ms |
468 KB |
Output is correct |
5 |
Correct |
5 ms |
468 KB |
Output is correct |
6 |
Correct |
1 ms |
468 KB |
Output is correct |
7 |
Correct |
612 ms |
488 KB |
Output is correct |
8 |
Correct |
987 ms |
416 KB |
Output is correct |
9 |
Correct |
803 ms |
400 KB |
Output is correct |
10 |
Correct |
749 ms |
400 KB |
Output is correct |
11 |
Correct |
5 ms |
480 KB |
Output is correct |
12 |
Correct |
8 ms |
468 KB |
Output is correct |
13 |
Correct |
5 ms |
468 KB |
Output is correct |
14 |
Correct |
4 ms |
476 KB |
Output is correct |
15 |
Correct |
1 ms |
468 KB |
Output is correct |
16 |
Correct |
633 ms |
516 KB |
Output is correct |
17 |
Correct |
587 ms |
400 KB |
Output is correct |
18 |
Correct |
598 ms |
580 KB |
Output is correct |
19 |
Correct |
654 ms |
400 KB |
Output is correct |
20 |
Correct |
615 ms |
400 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
328 KB |
Invalid labels (values out of range). scenario=1, k=1000000000, vertex=1, label=1378394698 |
2 |
Halted |
0 ms |
0 KB |
- |