#include<bits/stdc++.h>
#include "stations.h"
#define ll long long
#define fi first
#define se second
#define pb push_back
using namespace std;
const int N=1009;
int la[N];
vector<int>v[N];int re=0;
void dfs(int x,int p)
{
la[x]=++re;
for(auto it:v[x])
{
if(it==p)continue;
dfs(it,x);
}
}
vector<int> label(int n, int k,vector<int> U, vector<int> V) {
vector<int> l(n);
for(int i=0;i<n-1;i++)
{
v[U[i]].pb(V[i]);
v[V[i]].pb(U[i]);
}
int root=0;
for(int i=0;i<n;i++)if(v[i].size()>2)root=i;
l[root]=0;int r=-1;
for(auto it:v[root])
{r++;
re=r*1000;
dfs(it,root);
}
for(int i=0;i<n;i++)l[i]=la[i];
memset(la,0,sizeof la);for(int i=0;i<n;i++)v[i].clear();
return l;
}
int find_next_station(int s, int t, std::vector<int> c) {
int b1=s/1000;
int b2=t/1000;
if(t==0)
{
b2=b1;
}
if(s==0)
{
for(auto it:c)
{
int b=it/1000;
if(b==b2)return it;
}
}
if(b1==b2)
{
if(s<t)
{
return c[1];
}
return c[0];
}
return c[0];
}
/*
1
5 1000000
0 1
1 2
1 3
2 4
2
2 0 1
1 3 3
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
308 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1005 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
308 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=993, label=1001 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
568 ms |
504 KB |
Output is correct |
2 |
Correct |
470 ms |
528 KB |
Output is correct |
3 |
Correct |
901 ms |
452 KB |
Output is correct |
4 |
Correct |
658 ms |
400 KB |
Output is correct |
5 |
Correct |
596 ms |
400 KB |
Output is correct |
6 |
Correct |
475 ms |
552 KB |
Output is correct |
7 |
Correct |
457 ms |
508 KB |
Output is correct |
8 |
Correct |
2 ms |
468 KB |
Output is correct |
9 |
Correct |
5 ms |
468 KB |
Output is correct |
10 |
Correct |
2 ms |
468 KB |
Output is correct |
11 |
Correct |
619 ms |
512 KB |
Output is correct |
12 |
Correct |
451 ms |
632 KB |
Output is correct |
13 |
Correct |
507 ms |
620 KB |
Output is correct |
14 |
Correct |
436 ms |
620 KB |
Output is correct |
15 |
Correct |
51 ms |
644 KB |
Output is correct |
16 |
Correct |
67 ms |
556 KB |
Output is correct |
17 |
Correct |
115 ms |
788 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
843 ms |
572 KB |
Output is correct |
2 |
Correct |
659 ms |
400 KB |
Output is correct |
3 |
Correct |
634 ms |
512 KB |
Output is correct |
4 |
Correct |
2 ms |
468 KB |
Output is correct |
5 |
Correct |
5 ms |
468 KB |
Output is correct |
6 |
Correct |
2 ms |
468 KB |
Output is correct |
7 |
Correct |
582 ms |
400 KB |
Output is correct |
8 |
Correct |
754 ms |
516 KB |
Output is correct |
9 |
Correct |
685 ms |
512 KB |
Output is correct |
10 |
Correct |
538 ms |
400 KB |
Output is correct |
11 |
Incorrect |
5 ms |
480 KB |
Wrong query response. |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
521 ms |
600 KB |
Partially correct |
2 |
Partially correct |
406 ms |
528 KB |
Partially correct |
3 |
Correct |
830 ms |
488 KB |
Output is correct |
4 |
Partially correct |
617 ms |
400 KB |
Partially correct |
5 |
Partially correct |
565 ms |
528 KB |
Partially correct |
6 |
Partially correct |
452 ms |
512 KB |
Partially correct |
7 |
Partially correct |
428 ms |
532 KB |
Partially correct |
8 |
Partially correct |
3 ms |
468 KB |
Partially correct |
9 |
Correct |
4 ms |
468 KB |
Output is correct |
10 |
Partially correct |
1 ms |
464 KB |
Partially correct |
11 |
Incorrect |
434 ms |
528 KB |
Wrong query response. |
12 |
Halted |
0 ms |
0 KB |
- |