# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
321930 | 2020-11-13T14:02:35 Z | demetre | Stations (IOI20_stations) | C++14 | 1097 ms | 1248 KB |
#include "stations.h" #include<bits/stdc++.h> using namespace std; int fix[1005],timer; vector<int> V[1005],labels; void dfs(int u,int d){ fix[u]=1; if(d%2==0) timer++,labels[u]=timer; for(int i=0;i<V[u].size();i++){ if(!fix[V[u][i]]){ dfs(V[u][i],d+1); } } if(d%2!=0){ timer++; labels[u]=timer; } } std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { labels.clear(); labels.resize(n); for(int i=0;i<n;i++){ V[i].clear(); fix[i]=0; } for (int i = 0; i < u.size(); i++) { V[u[i]].push_back(v[i]); V[v[i]].push_back(u[i]); } timer=0; for(int i=0;i<n;i++){ if(fix[i]==0) dfs(i,0); } return labels; } int find_next_station(int s, int t, std::vector<int> c) { if(s<c[0]) { if(t>s){ for(int i=0;i<c.size()-1;i++){ if(t<=c[i]) return c[i]; } } return c[c.size()-1]; } else { if(t<s){ for(int i=c.size()-1;i>=1;i--) if(t>=c[i]) return c[i]; } return c[0]; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 654 ms | 1088 KB | Output is correct |
2 | Correct | 421 ms | 992 KB | Output is correct |
3 | Correct | 959 ms | 948 KB | Output is correct |
4 | Correct | 667 ms | 948 KB | Output is correct |
5 | Correct | 666 ms | 1120 KB | Output is correct |
6 | Correct | 485 ms | 1092 KB | Output is correct |
7 | Correct | 453 ms | 1112 KB | Output is correct |
8 | Correct | 3 ms | 956 KB | Output is correct |
9 | Correct | 5 ms | 864 KB | Output is correct |
10 | Correct | 2 ms | 864 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 535 ms | 1036 KB | Output is correct |
2 | Correct | 536 ms | 1140 KB | Output is correct |
3 | Correct | 964 ms | 1076 KB | Output is correct |
4 | Correct | 705 ms | 1236 KB | Output is correct |
5 | Correct | 671 ms | 864 KB | Output is correct |
6 | Correct | 493 ms | 864 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 600 ms | 932 KB | Output is correct |
2 | Correct | 428 ms | 1136 KB | Output is correct |
3 | Correct | 841 ms | 864 KB | Output is correct |
4 | Correct | 734 ms | 948 KB | Output is correct |
5 | Correct | 733 ms | 864 KB | Output is correct |
6 | Correct | 516 ms | 1248 KB | Output is correct |
7 | Correct | 528 ms | 992 KB | Output is correct |
8 | Correct | 3 ms | 864 KB | Output is correct |
9 | Correct | 5 ms | 864 KB | Output is correct |
10 | Correct | 2 ms | 864 KB | Output is correct |
11 | Correct | 664 ms | 760 KB | Output is correct |
12 | Correct | 566 ms | 1040 KB | Output is correct |
13 | Correct | 566 ms | 896 KB | Output is correct |
14 | Correct | 446 ms | 968 KB | Output is correct |
15 | Correct | 77 ms | 864 KB | Output is correct |
16 | Correct | 63 ms | 912 KB | Output is correct |
17 | Correct | 125 ms | 864 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 943 ms | 864 KB | Output is correct |
2 | Correct | 669 ms | 896 KB | Output is correct |
3 | Correct | 561 ms | 864 KB | Output is correct |
4 | Correct | 3 ms | 956 KB | Output is correct |
5 | Correct | 5 ms | 736 KB | Output is correct |
6 | Correct | 2 ms | 864 KB | Output is correct |
7 | Correct | 560 ms | 948 KB | Output is correct |
8 | Correct | 1083 ms | 736 KB | Output is correct |
9 | Correct | 666 ms | 864 KB | Output is correct |
10 | Correct | 656 ms | 948 KB | Output is correct |
11 | Correct | 7 ms | 864 KB | Output is correct |
12 | Correct | 6 ms | 864 KB | Output is correct |
13 | Correct | 6 ms | 736 KB | Output is correct |
14 | Correct | 4 ms | 736 KB | Output is correct |
15 | Correct | 2 ms | 996 KB | Output is correct |
16 | Correct | 470 ms | 864 KB | Output is correct |
17 | Correct | 453 ms | 736 KB | Output is correct |
18 | Correct | 572 ms | 864 KB | Output is correct |
19 | Correct | 553 ms | 736 KB | Output is correct |
20 | Correct | 516 ms | 736 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 516 ms | 976 KB | Output is correct |
2 | Correct | 453 ms | 1088 KB | Output is correct |
3 | Correct | 824 ms | 736 KB | Output is correct |
4 | Correct | 646 ms | 948 KB | Output is correct |
5 | Correct | 793 ms | 1076 KB | Output is correct |
6 | Correct | 416 ms | 1088 KB | Output is correct |
7 | Correct | 418 ms | 868 KB | Output is correct |
8 | Correct | 3 ms | 736 KB | Output is correct |
9 | Correct | 5 ms | 948 KB | Output is correct |
10 | Correct | 2 ms | 956 KB | Output is correct |
11 | Correct | 499 ms | 840 KB | Output is correct |
12 | Correct | 579 ms | 736 KB | Output is correct |
13 | Correct | 1097 ms | 948 KB | Output is correct |
14 | Correct | 838 ms | 748 KB | Output is correct |
15 | Correct | 635 ms | 992 KB | Output is correct |
16 | Correct | 496 ms | 904 KB | Output is correct |
17 | Correct | 591 ms | 864 KB | Output is correct |
18 | Correct | 460 ms | 1108 KB | Output is correct |
19 | Correct | 461 ms | 992 KB | Output is correct |
20 | Correct | 452 ms | 892 KB | Output is correct |
21 | Correct | 71 ms | 948 KB | Output is correct |
22 | Correct | 73 ms | 864 KB | Output is correct |
23 | Correct | 93 ms | 864 KB | Output is correct |
24 | Correct | 6 ms | 736 KB | Output is correct |
25 | Correct | 5 ms | 948 KB | Output is correct |
26 | Correct | 5 ms | 736 KB | Output is correct |
27 | Correct | 4 ms | 736 KB | Output is correct |
28 | Correct | 2 ms | 948 KB | Output is correct |
29 | Correct | 563 ms | 992 KB | Output is correct |
30 | Correct | 623 ms | 864 KB | Output is correct |
31 | Correct | 584 ms | 992 KB | Output is correct |
32 | Correct | 488 ms | 948 KB | Output is correct |
33 | Correct | 475 ms | 736 KB | Output is correct |
34 | Correct | 300 ms | 864 KB | Output is correct |
35 | Correct | 426 ms | 1076 KB | Output is correct |
36 | Correct | 430 ms | 1088 KB | Output is correct |
37 | Correct | 453 ms | 992 KB | Output is correct |
38 | Correct | 450 ms | 1124 KB | Output is correct |
39 | Correct | 440 ms | 1120 KB | Output is correct |
40 | Correct | 402 ms | 992 KB | Output is correct |
41 | Correct | 433 ms | 1240 KB | Output is correct |
42 | Correct | 60 ms | 736 KB | Output is correct |
43 | Correct | 96 ms | 880 KB | Output is correct |
44 | Correct | 120 ms | 864 KB | Output is correct |
45 | Correct | 150 ms | 1120 KB | Output is correct |
46 | Correct | 316 ms | 864 KB | Output is correct |
47 | Correct | 394 ms | 736 KB | Output is correct |
48 | Correct | 64 ms | 864 KB | Output is correct |
49 | Correct | 53 ms | 1084 KB | Output is correct |