#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;
int m;
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*m+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]);
}
m=1000;
//for(int i=0;i<n;i++)
//m = max(m,(int)adj[i].size());
dfs(0,0,0);
return lbl;
}
int find_next_station(int s, int t, std::vector<int> c) {
m=1000;
int a =s,b=t;
while(a>0){
a= (a-1)/m;
if(a==b)break;
}
if(a==b)return (s-1)/m;
a=s,b=t;
int p=b;
while(b>0){
p=b;
b = (b-1)/m;
if(a==b)break;
}
if(a==b)return p;
return (s-1)/m;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
440 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=-452758934 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
308 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=3, label=1002 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
456 KB |
Invalid labels (values out of range). scenario=1, k=1000000, vertex=1, label=-1486640022 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
988 ms |
404 KB |
Output is correct |
2 |
Correct |
813 ms |
400 KB |
Output is correct |
3 |
Correct |
676 ms |
400 KB |
Output is correct |
4 |
Correct |
3 ms |
468 KB |
Output is correct |
5 |
Incorrect |
1 ms |
200 KB |
Invalid labels (values out of range). scenario=0, k=1000000000, vertex=4, label=1002002002 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
444 KB |
Invalid labels (values out of range). scenario=1, k=1000000000, vertex=2, label=-1496863639 |
2 |
Halted |
0 ms |
0 KB |
- |