# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
341711 | 2020-12-30T14:18:37 Z | ogibogi2004 | Stations (IOI20_stations) | C++14 | 1174 ms | 1252 KB |
#include "stations.h" #include <vector> #include<bits/stdc++.h> using namespace std; #define time afds const int MAXN=1024; vector<int>g[MAXN]; int depth[MAXN]; int in_time[MAXN],out_time[MAXN],time=-1; void dfs(int u,int par) { in_time[u]=++time; for(auto v:g[u]) { if(v==par)continue; depth[v]=depth[u]+1; dfs(v,u); } out_time[u]=++time; } vector<int> label(int n, int k, vector<int> u, vector<int> v) { vector<int> labels(n); time=-1; memset(depth,-1,sizeof(depth)); for(int i=0;i<=n;i++)g[i].clear(); for(int i=0;i<u.size();i++) { g[u[i]].push_back(v[i]); g[v[i]].push_back(u[i]); } dfs(0,-1); set<int>l; map<int,int>mp; for (int i = 0; i < n; i++) { if(depth[i]%2==0) { labels[i]=in_time[i]; } else labels[i]=out_time[i]; l.insert(labels[i]); } int cnt=0; for(auto xd:l) { mp[xd]=cnt;++cnt; } for(int i=0;i<n;i++) { labels[i]=mp[labels[i]]; } return labels; } int find_next_station(int s, int t, vector<int> c) { if(c.size()==1)return c[0]; if(s<c[0]) { if(t<s) { return c.back(); } for(int i=0;i<c.size();i++) { if(c[i]>=t)return c[i]; } return c.back(); } else { if(t>s) { return c[0]; } for(int i=c.size()-1;i>=0;i--) { if(c[i]<=t)return c[i]; } return c[0]; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 730 ms | 1252 KB | Output is correct |
2 | Correct | 499 ms | 992 KB | Output is correct |
3 | Correct | 891 ms | 736 KB | Output is correct |
4 | Correct | 707 ms | 992 KB | Output is correct |
5 | Correct | 579 ms | 1120 KB | Output is correct |
6 | Correct | 611 ms | 1248 KB | Output is correct |
7 | Correct | 533 ms | 864 KB | Output is correct |
8 | Correct | 3 ms | 940 KB | Output is correct |
9 | Correct | 5 ms | 864 KB | Output is correct |
10 | Correct | 2 ms | 880 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 529 ms | 1048 KB | Output is correct |
2 | Correct | 625 ms | 1052 KB | Output is correct |
3 | Correct | 936 ms | 736 KB | Output is correct |
4 | Correct | 929 ms | 864 KB | Output is correct |
5 | Correct | 807 ms | 864 KB | Output is correct |
6 | Correct | 434 ms | 992 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 587 ms | 992 KB | Output is correct |
2 | Correct | 605 ms | 864 KB | Output is correct |
3 | Correct | 1029 ms | 940 KB | Output is correct |
4 | Correct | 745 ms | 864 KB | Output is correct |
5 | Correct | 621 ms | 940 KB | Output is correct |
6 | Correct | 523 ms | 992 KB | Output is correct |
7 | Correct | 551 ms | 992 KB | Output is correct |
8 | Correct | 4 ms | 864 KB | Output is correct |
9 | Correct | 5 ms | 904 KB | Output is correct |
10 | Correct | 1 ms | 864 KB | Output is correct |
11 | Correct | 667 ms | 940 KB | Output is correct |
12 | Correct | 605 ms | 1236 KB | Output is correct |
13 | Correct | 478 ms | 1120 KB | Output is correct |
14 | Correct | 428 ms | 992 KB | Output is correct |
15 | Correct | 69 ms | 924 KB | Output is correct |
16 | Correct | 86 ms | 864 KB | Output is correct |
17 | Correct | 130 ms | 992 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1061 ms | 864 KB | Output is correct |
2 | Correct | 758 ms | 940 KB | Output is correct |
3 | Correct | 649 ms | 884 KB | Output is correct |
4 | Correct | 3 ms | 980 KB | Output is correct |
5 | Correct | 5 ms | 940 KB | Output is correct |
6 | Correct | 2 ms | 940 KB | Output is correct |
7 | Correct | 679 ms | 992 KB | Output is correct |
8 | Correct | 939 ms | 940 KB | Output is correct |
9 | Correct | 903 ms | 940 KB | Output is correct |
10 | Correct | 756 ms | 896 KB | Output is correct |
11 | Correct | 7 ms | 948 KB | Output is correct |
12 | Correct | 5 ms | 864 KB | Output is correct |
13 | Correct | 5 ms | 736 KB | Output is correct |
14 | Correct | 4 ms | 948 KB | Output is correct |
15 | Correct | 2 ms | 864 KB | Output is correct |
16 | Correct | 550 ms | 864 KB | Output is correct |
17 | Correct | 569 ms | 736 KB | Output is correct |
18 | Correct | 596 ms | 864 KB | Output is correct |
19 | Correct | 631 ms | 1108 KB | Output is correct |
20 | Correct | 657 ms | 992 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 692 ms | 1252 KB | Output is correct |
2 | Correct | 510 ms | 996 KB | Output is correct |
3 | Correct | 1174 ms | 940 KB | Output is correct |
4 | Correct | 891 ms | 980 KB | Output is correct |
5 | Correct | 814 ms | 864 KB | Output is correct |
6 | Correct | 441 ms | 992 KB | Output is correct |
7 | Correct | 584 ms | 1120 KB | Output is correct |
8 | Correct | 3 ms | 896 KB | Output is correct |
9 | Correct | 4 ms | 736 KB | Output is correct |
10 | Correct | 1 ms | 736 KB | Output is correct |
11 | Correct | 439 ms | 992 KB | Output is correct |
12 | Correct | 535 ms | 864 KB | Output is correct |
13 | Correct | 957 ms | 940 KB | Output is correct |
14 | Correct | 758 ms | 992 KB | Output is correct |
15 | Correct | 674 ms | 940 KB | Output is correct |
16 | Correct | 525 ms | 1052 KB | Output is correct |
17 | Correct | 749 ms | 940 KB | Output is correct |
18 | Correct | 604 ms | 1004 KB | Output is correct |
19 | Correct | 535 ms | 1120 KB | Output is correct |
20 | Correct | 426 ms | 1180 KB | Output is correct |
21 | Correct | 66 ms | 896 KB | Output is correct |
22 | Correct | 75 ms | 992 KB | Output is correct |
23 | Correct | 106 ms | 992 KB | Output is correct |
24 | Correct | 6 ms | 736 KB | Output is correct |
25 | Correct | 6 ms | 940 KB | Output is correct |
26 | Correct | 4 ms | 940 KB | Output is correct |
27 | Correct | 4 ms | 736 KB | Output is correct |
28 | Correct | 2 ms | 776 KB | Output is correct |
29 | Correct | 652 ms | 864 KB | Output is correct |
30 | Correct | 518 ms | 940 KB | Output is correct |
31 | Correct | 717 ms | 864 KB | Output is correct |
32 | Correct | 661 ms | 1076 KB | Output is correct |
33 | Correct | 681 ms | 948 KB | Output is correct |
34 | Correct | 292 ms | 1004 KB | Output is correct |
35 | Correct | 603 ms | 992 KB | Output is correct |
36 | Correct | 445 ms | 992 KB | Output is correct |
37 | Correct | 447 ms | 1020 KB | Output is correct |
38 | Correct | 440 ms | 1020 KB | Output is correct |
39 | Correct | 463 ms | 1248 KB | Output is correct |
40 | Correct | 445 ms | 992 KB | Output is correct |
41 | Correct | 452 ms | 1012 KB | Output is correct |
42 | Correct | 62 ms | 1076 KB | Output is correct |
43 | Correct | 119 ms | 864 KB | Output is correct |
44 | Correct | 138 ms | 1040 KB | Output is correct |
45 | Correct | 146 ms | 1020 KB | Output is correct |
46 | Correct | 321 ms | 1072 KB | Output is correct |
47 | Correct | 330 ms | 1236 KB | Output is correct |
48 | Correct | 70 ms | 992 KB | Output is correct |
49 | Correct | 66 ms | 1120 KB | Output is correct |