#include "stations.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vii vector<vi>
#define pi pair<int,int>
int nd;
vi l;
vii g;
void dfs(int node, int parent){
nd++;
int temp=nd;
for(int child:g[node]){
if(child==parent)continue;
dfs(child,node);
}
l[node]=1000*temp +nd;
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
g.clear();
g.resize(2*n);
l.resize(n);
std::vector<int> labels(n);
for(int i=0;i<n-1;i++){
g[u[i]].push_back(v[i]);
g[v[i]].push_back(u[i]);
}
nd =-1;
dfs(0,-1);
return l;
}
int find_next_station(int s, int t, std::vector<int> c) {
int target=t/1000;
int biggest=s%1000;
int current=s/1000;
if(target>current && target<=biggest){
for(int i:c){
int cr=i/1000;
int b=i%1000;
if(target>=cr && target<=b && cr>current)return i;
}
}
for(int i:c){
if(i/1000<current)return i;
}
}
Compilation message
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:51:1: warning: control reaches end of non-void function [-Wreturn-type]
51 | }
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
424 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=6009 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
420 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1511 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
359 ms |
636 KB |
Output is correct |
2 |
Correct |
289 ms |
672 KB |
Output is correct |
3 |
Correct |
664 ms |
504 KB |
Output is correct |
4 |
Correct |
420 ms |
500 KB |
Output is correct |
5 |
Correct |
428 ms |
504 KB |
Output is correct |
6 |
Correct |
348 ms |
676 KB |
Output is correct |
7 |
Correct |
302 ms |
544 KB |
Output is correct |
8 |
Correct |
1 ms |
492 KB |
Output is correct |
9 |
Correct |
3 ms |
488 KB |
Output is correct |
10 |
Correct |
1 ms |
492 KB |
Output is correct |
11 |
Correct |
359 ms |
508 KB |
Output is correct |
12 |
Correct |
323 ms |
712 KB |
Output is correct |
13 |
Correct |
325 ms |
700 KB |
Output is correct |
14 |
Correct |
310 ms |
500 KB |
Output is correct |
15 |
Correct |
39 ms |
444 KB |
Output is correct |
16 |
Correct |
49 ms |
544 KB |
Output is correct |
17 |
Correct |
82 ms |
548 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
561 ms |
416 KB |
Output is correct |
2 |
Correct |
402 ms |
416 KB |
Output is correct |
3 |
Correct |
408 ms |
500 KB |
Output is correct |
4 |
Correct |
1 ms |
500 KB |
Output is correct |
5 |
Correct |
2 ms |
528 KB |
Output is correct |
6 |
Correct |
0 ms |
492 KB |
Output is correct |
7 |
Correct |
352 ms |
504 KB |
Output is correct |
8 |
Correct |
625 ms |
420 KB |
Output is correct |
9 |
Correct |
425 ms |
508 KB |
Output is correct |
10 |
Correct |
424 ms |
416 KB |
Output is correct |
11 |
Correct |
3 ms |
492 KB |
Output is correct |
12 |
Correct |
2 ms |
492 KB |
Output is correct |
13 |
Correct |
2 ms |
496 KB |
Output is correct |
14 |
Correct |
2 ms |
492 KB |
Output is correct |
15 |
Correct |
1 ms |
556 KB |
Output is correct |
16 |
Correct |
390 ms |
504 KB |
Output is correct |
17 |
Correct |
355 ms |
420 KB |
Output is correct |
18 |
Correct |
350 ms |
416 KB |
Output is correct |
19 |
Correct |
333 ms |
544 KB |
Output is correct |
20 |
Correct |
351 ms |
420 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
380 ms |
804 KB |
Partially correct |
2 |
Partially correct |
346 ms |
768 KB |
Partially correct |
3 |
Partially correct |
577 ms |
420 KB |
Partially correct |
4 |
Partially correct |
490 ms |
508 KB |
Partially correct |
5 |
Partially correct |
393 ms |
508 KB |
Partially correct |
6 |
Partially correct |
311 ms |
672 KB |
Partially correct |
7 |
Partially correct |
269 ms |
636 KB |
Partially correct |
8 |
Partially correct |
1 ms |
492 KB |
Partially correct |
9 |
Partially correct |
2 ms |
500 KB |
Partially correct |
10 |
Partially correct |
0 ms |
500 KB |
Partially correct |
11 |
Partially correct |
336 ms |
712 KB |
Partially correct |
12 |
Partially correct |
385 ms |
548 KB |
Partially correct |
13 |
Partially correct |
657 ms |
416 KB |
Partially correct |
14 |
Partially correct |
444 ms |
500 KB |
Partially correct |
15 |
Partially correct |
402 ms |
420 KB |
Partially correct |
16 |
Partially correct |
330 ms |
504 KB |
Partially correct |
17 |
Partially correct |
391 ms |
420 KB |
Partially correct |
18 |
Partially correct |
294 ms |
628 KB |
Partially correct |
19 |
Partially correct |
318 ms |
632 KB |
Partially correct |
20 |
Partially correct |
368 ms |
612 KB |
Partially correct |
21 |
Partially correct |
38 ms |
492 KB |
Partially correct |
22 |
Partially correct |
61 ms |
544 KB |
Partially correct |
23 |
Partially correct |
78 ms |
572 KB |
Partially correct |
24 |
Partially correct |
3 ms |
500 KB |
Partially correct |
25 |
Partially correct |
4 ms |
496 KB |
Partially correct |
26 |
Partially correct |
4 ms |
492 KB |
Partially correct |
27 |
Partially correct |
1 ms |
492 KB |
Partially correct |
28 |
Partially correct |
1 ms |
492 KB |
Partially correct |
29 |
Partially correct |
399 ms |
420 KB |
Partially correct |
30 |
Partially correct |
367 ms |
416 KB |
Partially correct |
31 |
Partially correct |
284 ms |
508 KB |
Partially correct |
32 |
Partially correct |
373 ms |
612 KB |
Partially correct |
33 |
Partially correct |
321 ms |
508 KB |
Partially correct |
34 |
Partially correct |
222 ms |
632 KB |
Partially correct |
35 |
Partially correct |
293 ms |
676 KB |
Partially correct |
36 |
Partially correct |
307 ms |
836 KB |
Partially correct |
37 |
Partially correct |
328 ms |
716 KB |
Partially correct |
38 |
Partially correct |
321 ms |
668 KB |
Partially correct |
39 |
Partially correct |
288 ms |
804 KB |
Partially correct |
40 |
Partially correct |
311 ms |
724 KB |
Partially correct |
41 |
Partially correct |
324 ms |
692 KB |
Partially correct |
42 |
Partially correct |
41 ms |
572 KB |
Partially correct |
43 |
Partially correct |
71 ms |
612 KB |
Partially correct |
44 |
Partially correct |
106 ms |
572 KB |
Partially correct |
45 |
Partially correct |
107 ms |
544 KB |
Partially correct |
46 |
Partially correct |
246 ms |
508 KB |
Partially correct |
47 |
Partially correct |
217 ms |
628 KB |
Partially correct |
48 |
Partially correct |
44 ms |
544 KB |
Partially correct |
49 |
Partially correct |
57 ms |
764 KB |
Partially correct |