# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
320605 | 2020-11-09T08:33:19 Z | kshitij_sodani | Stations (IOI20_stations) | C++14 | 1178 ms | 1276 KB |
#include <bits/stdc++.h> using namespace std; typedef long long llo; #define mp make_pair #define pb push_back #define a first #define b second #define endl '\n' #include "stations.h" vector<int> adj[1001]; int co=0; int st[1001]; int endd[1001]; int levv[1001]; int nn; void dfs(int no,int par=-1,int levv=0){ if(levv%2==0){ st[no]=co; co++; } for(auto j:adj[no]){ if(j!=par){ dfs(j,no,levv+1); } } if(levv%2==1){ st[no]=co; co++; } } std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { nn=n; for(int i=0;i<n;i++){ adj[i].clear(); } co=0; for(int i=0;i<n-1;i++){ adj[u[i]].pb(v[i]); adj[v[i]].pb(u[i]); } dfs(0); vector<int> ans; for(int i=0;i<n;i++){ ans.pb(st[i]); // cout<<st[i]; } //cout<<endl; return ans; } int find_next_station(int s, int t, std::vector<int> c) { if(c.size()==1){ return c[0]; } sort(c.begin(),c.end()); /*vector<int> cc; for(auto j:c){ if(j>=1000){ cc.pb(j-1000); } else{ cc.pb(j); } }*/ if(s<c[0]){ int pre=s-1; for(int i=0;i<c.size()-1;i++){ int la=0; if(i==0){ la=s; } else{ la=c[i-1]+1; } if(t<=c[i] and t>=la){ return c[i]; } } return c.back(); } else{ for(int i=c.size()-1;i>0;i--){ int la=0; if(i==c.size()-1){ la=s; } else{ la=c[i+1]-1; } if(t<=la and t>=c[i]){ return c[i]; } } return c[0]; } return c[0]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 649 ms | 1276 KB | Output is correct |
2 | Correct | 516 ms | 1028 KB | Output is correct |
3 | Correct | 1107 ms | 984 KB | Output is correct |
4 | Correct | 669 ms | 940 KB | Output is correct |
5 | Correct | 635 ms | 1108 KB | Output is correct |
6 | Correct | 470 ms | 1128 KB | Output is correct |
7 | Correct | 528 ms | 1092 KB | Output is correct |
8 | Correct | 3 ms | 948 KB | Output is correct |
9 | Correct | 4 ms | 940 KB | Output is correct |
10 | Correct | 2 ms | 736 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 557 ms | 888 KB | Output is correct |
2 | Correct | 685 ms | 1012 KB | Output is correct |
3 | Correct | 1055 ms | 864 KB | Output is correct |
4 | Correct | 690 ms | 1244 KB | Output is correct |
5 | Correct | 832 ms | 736 KB | Output is correct |
6 | Correct | 470 ms | 892 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 505 ms | 864 KB | Output is correct |
2 | Correct | 515 ms | 992 KB | Output is correct |
3 | Correct | 1178 ms | 864 KB | Output is correct |
4 | Correct | 677 ms | 1068 KB | Output is correct |
5 | Correct | 596 ms | 864 KB | Output is correct |
6 | Correct | 612 ms | 992 KB | Output is correct |
7 | Correct | 464 ms | 1080 KB | Output is correct |
8 | Correct | 3 ms | 864 KB | Output is correct |
9 | Correct | 5 ms | 948 KB | Output is correct |
10 | Correct | 2 ms | 940 KB | Output is correct |
11 | Correct | 599 ms | 940 KB | Output is correct |
12 | Correct | 564 ms | 992 KB | Output is correct |
13 | Correct | 437 ms | 1056 KB | Output is correct |
14 | Correct | 481 ms | 884 KB | Output is correct |
15 | Correct | 57 ms | 864 KB | Output is correct |
16 | Correct | 77 ms | 864 KB | Output is correct |
17 | Correct | 125 ms | 888 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 898 ms | 940 KB | Output is correct |
2 | Correct | 869 ms | 984 KB | Output is correct |
3 | Correct | 808 ms | 736 KB | Output is correct |
4 | Correct | 3 ms | 736 KB | Output is correct |
5 | Correct | 5 ms | 736 KB | Output is correct |
6 | Correct | 1 ms | 736 KB | Output is correct |
7 | Correct | 656 ms | 736 KB | Output is correct |
8 | Correct | 901 ms | 940 KB | Output is correct |
9 | Correct | 701 ms | 944 KB | Output is correct |
10 | Correct | 647 ms | 940 KB | Output is correct |
11 | Correct | 6 ms | 1064 KB | Output is correct |
12 | Correct | 7 ms | 736 KB | Output is correct |
13 | Correct | 6 ms | 944 KB | Output is correct |
14 | Correct | 4 ms | 896 KB | Output is correct |
15 | Correct | 2 ms | 864 KB | Output is correct |
16 | Correct | 488 ms | 864 KB | Output is correct |
17 | Correct | 564 ms | 736 KB | Output is correct |
18 | Correct | 574 ms | 864 KB | Output is correct |
19 | Correct | 535 ms | 952 KB | Output is correct |
20 | Correct | 683 ms | 864 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 556 ms | 1060 KB | Output is correct |
2 | Correct | 496 ms | 864 KB | Output is correct |
3 | Correct | 997 ms | 1068 KB | Output is correct |
4 | Correct | 665 ms | 748 KB | Output is correct |
5 | Correct | 571 ms | 944 KB | Output is correct |
6 | Correct | 439 ms | 864 KB | Output is correct |
7 | Correct | 596 ms | 864 KB | Output is correct |
8 | Correct | 3 ms | 940 KB | Output is correct |
9 | Correct | 4 ms | 864 KB | Output is correct |
10 | Correct | 1 ms | 864 KB | Output is correct |
11 | Correct | 548 ms | 736 KB | Output is correct |
12 | Correct | 645 ms | 884 KB | Output is correct |
13 | Correct | 904 ms | 936 KB | Output is correct |
14 | Correct | 804 ms | 940 KB | Output is correct |
15 | Correct | 662 ms | 944 KB | Output is correct |
16 | Correct | 473 ms | 1120 KB | Output is correct |
17 | Correct | 721 ms | 940 KB | Output is correct |
18 | Correct | 532 ms | 1112 KB | Output is correct |
19 | Correct | 523 ms | 1064 KB | Output is correct |
20 | Correct | 498 ms | 736 KB | Output is correct |
21 | Correct | 72 ms | 864 KB | Output is correct |
22 | Correct | 91 ms | 736 KB | Output is correct |
23 | Correct | 138 ms | 880 KB | Output is correct |
24 | Correct | 7 ms | 948 KB | Output is correct |
25 | Correct | 7 ms | 736 KB | Output is correct |
26 | Correct | 6 ms | 864 KB | Output is correct |
27 | Correct | 4 ms | 736 KB | Output is correct |
28 | Correct | 2 ms | 864 KB | Output is correct |
29 | Correct | 492 ms | 884 KB | Output is correct |
30 | Correct | 561 ms | 948 KB | Output is correct |
31 | Correct | 656 ms | 948 KB | Output is correct |
32 | Correct | 523 ms | 936 KB | Output is correct |
33 | Correct | 470 ms | 864 KB | Output is correct |
34 | Correct | 337 ms | 1208 KB | Output is correct |
35 | Correct | 406 ms | 1044 KB | Output is correct |
36 | Correct | 439 ms | 1072 KB | Output is correct |
37 | Correct | 466 ms | 1220 KB | Output is correct |
38 | Correct | 453 ms | 1004 KB | Output is correct |
39 | Correct | 474 ms | 1112 KB | Output is correct |
40 | Correct | 468 ms | 1112 KB | Output is correct |
41 | Correct | 434 ms | 1228 KB | Output is correct |
42 | Correct | 63 ms | 888 KB | Output is correct |
43 | Correct | 100 ms | 864 KB | Output is correct |
44 | Correct | 124 ms | 864 KB | Output is correct |
45 | Correct | 167 ms | 992 KB | Output is correct |
46 | Correct | 312 ms | 864 KB | Output is correct |
47 | Correct | 306 ms | 1104 KB | Output is correct |
48 | Correct | 66 ms | 1088 KB | Output is correct |
49 | Correct | 63 ms | 864 KB | Output is correct |