# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1065938 | 2024-08-19T13:19:26 Z | Ahmed57 | Stations (IOI20_stations) | C++17 | 632 ms | 1056 KB |
#include "bits/stdc++.h" using namespace std; int dep[1001]; int timer = 0; vector<int> adj[1001]; int in[1001],out[1001]; void dfs(int i,int pr){ dep[i] = dep[pr]+1; if(dep[i]%2){ timer++; } in[i] = timer; for(auto j:adj[i]){ if(j==pr)continue; dfs(j,i); } if(dep[i]%2==0)timer++; out[i] = timer; } vector<int> label(int n, int k, vector<int> u, vector<int> v){ timer = 0; for(int i = 0;i<n;i++){ adj[i].clear(); } for(int i = 0;i<n-1;i++){ adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } dep[0] = 1; dfs(0,0); vector<int> lol; for(int i = 0;i<n;i++){ if(dep[i]%2==0){ lol.push_back(in[i]); //cout<<in[i]<<" "; }else{ lol.push_back(out[i]); //cout<<out[i]<<" "; } } return lol; } int find_next_station(int s, int t, vector<int> c){ sort(c.begin(),c.end()); if(c.size()==1)return c[0]; if(c[0]<s){ vector<int> na; for(int i = 1;i<c.size();i++)na.push_back(c[i]); na.push_back(s); if(t<c[1]||t>s)return c[0]; int lol = 0; for(int i = 0;i<na.size();i++){ if(t>=na[i]){ lol = na[i]; } } return lol; }else{ vector<int> na; na.push_back(s); for(int i = 0;i<c.size()-1;i++)na.push_back(c[i]); if(t>c[c.size()-2]||t<s)return c.back(); int lol = 0; for(int i = 0;i<na.size();i++){ if(t<=na[i]){ lol = na[i]; break; } } return lol; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 369 ms | 684 KB | Output is correct |
2 | Correct | 284 ms | 696 KB | Output is correct |
3 | Correct | 576 ms | 684 KB | Output is correct |
4 | Correct | 457 ms | 684 KB | Output is correct |
5 | Correct | 379 ms | 684 KB | Output is correct |
6 | Correct | 340 ms | 684 KB | Output is correct |
7 | Correct | 281 ms | 688 KB | Output is correct |
8 | Correct | 2 ms | 768 KB | Output is correct |
9 | Correct | 1 ms | 768 KB | Output is correct |
10 | Correct | 1 ms | 764 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 275 ms | 684 KB | Output is correct |
2 | Correct | 327 ms | 684 KB | Output is correct |
3 | Correct | 568 ms | 684 KB | Output is correct |
4 | Correct | 443 ms | 684 KB | Output is correct |
5 | Correct | 396 ms | 680 KB | Output is correct |
6 | Correct | 328 ms | 684 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 374 ms | 688 KB | Output is correct |
2 | Correct | 307 ms | 684 KB | Output is correct |
3 | Correct | 632 ms | 684 KB | Output is correct |
4 | Correct | 459 ms | 684 KB | Output is correct |
5 | Correct | 417 ms | 684 KB | Output is correct |
6 | Correct | 307 ms | 684 KB | Output is correct |
7 | Correct | 292 ms | 684 KB | Output is correct |
8 | Correct | 1 ms | 768 KB | Output is correct |
9 | Correct | 2 ms | 768 KB | Output is correct |
10 | Correct | 0 ms | 768 KB | Output is correct |
11 | Correct | 420 ms | 684 KB | Output is correct |
12 | Correct | 316 ms | 796 KB | Output is correct |
13 | Correct | 320 ms | 932 KB | Output is correct |
14 | Correct | 290 ms | 684 KB | Output is correct |
15 | Correct | 26 ms | 764 KB | Output is correct |
16 | Correct | 39 ms | 768 KB | Output is correct |
17 | Correct | 63 ms | 688 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 619 ms | 684 KB | Output is correct |
2 | Correct | 508 ms | 684 KB | Output is correct |
3 | Correct | 388 ms | 684 KB | Output is correct |
4 | Correct | 2 ms | 776 KB | Output is correct |
5 | Correct | 2 ms | 768 KB | Output is correct |
6 | Correct | 0 ms | 768 KB | Output is correct |
7 | Correct | 393 ms | 684 KB | Output is correct |
8 | Correct | 619 ms | 684 KB | Output is correct |
9 | Correct | 455 ms | 936 KB | Output is correct |
10 | Correct | 424 ms | 684 KB | Output is correct |
11 | Correct | 3 ms | 768 KB | Output is correct |
12 | Correct | 3 ms | 776 KB | Output is correct |
13 | Correct | 3 ms | 776 KB | Output is correct |
14 | Correct | 3 ms | 776 KB | Output is correct |
15 | Correct | 1 ms | 768 KB | Output is correct |
16 | Correct | 306 ms | 684 KB | Output is correct |
17 | Correct | 371 ms | 684 KB | Output is correct |
18 | Correct | 333 ms | 684 KB | Output is correct |
19 | Correct | 324 ms | 684 KB | Output is correct |
20 | Correct | 359 ms | 684 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 378 ms | 684 KB | Output is correct |
2 | Correct | 329 ms | 684 KB | Output is correct |
3 | Correct | 606 ms | 684 KB | Output is correct |
4 | Correct | 420 ms | 688 KB | Output is correct |
5 | Correct | 434 ms | 684 KB | Output is correct |
6 | Correct | 296 ms | 684 KB | Output is correct |
7 | Correct | 299 ms | 684 KB | Output is correct |
8 | Correct | 1 ms | 776 KB | Output is correct |
9 | Correct | 1 ms | 776 KB | Output is correct |
10 | Correct | 0 ms | 776 KB | Output is correct |
11 | Correct | 281 ms | 684 KB | Output is correct |
12 | Correct | 348 ms | 684 KB | Output is correct |
13 | Correct | 550 ms | 684 KB | Output is correct |
14 | Correct | 457 ms | 684 KB | Output is correct |
15 | Correct | 427 ms | 712 KB | Output is correct |
16 | Correct | 313 ms | 684 KB | Output is correct |
17 | Correct | 420 ms | 684 KB | Output is correct |
18 | Correct | 289 ms | 796 KB | Output is correct |
19 | Correct | 323 ms | 792 KB | Output is correct |
20 | Correct | 310 ms | 684 KB | Output is correct |
21 | Correct | 27 ms | 764 KB | Output is correct |
22 | Correct | 38 ms | 716 KB | Output is correct |
23 | Correct | 63 ms | 716 KB | Output is correct |
24 | Correct | 2 ms | 776 KB | Output is correct |
25 | Correct | 2 ms | 768 KB | Output is correct |
26 | Correct | 2 ms | 768 KB | Output is correct |
27 | Correct | 1 ms | 768 KB | Output is correct |
28 | Correct | 0 ms | 768 KB | Output is correct |
29 | Correct | 341 ms | 684 KB | Output is correct |
30 | Correct | 355 ms | 684 KB | Output is correct |
31 | Correct | 369 ms | 684 KB | Output is correct |
32 | Correct | 327 ms | 684 KB | Output is correct |
33 | Correct | 347 ms | 684 KB | Output is correct |
34 | Correct | 215 ms | 684 KB | Output is correct |
35 | Correct | 267 ms | 940 KB | Output is correct |
36 | Correct | 307 ms | 684 KB | Output is correct |
37 | Correct | 351 ms | 800 KB | Output is correct |
38 | Correct | 312 ms | 796 KB | Output is correct |
39 | Correct | 310 ms | 1056 KB | Output is correct |
40 | Correct | 319 ms | 800 KB | Output is correct |
41 | Correct | 341 ms | 940 KB | Output is correct |
42 | Correct | 43 ms | 768 KB | Output is correct |
43 | Correct | 55 ms | 768 KB | Output is correct |
44 | Correct | 72 ms | 684 KB | Output is correct |
45 | Correct | 110 ms | 772 KB | Output is correct |
46 | Correct | 200 ms | 684 KB | Output is correct |
47 | Correct | 195 ms | 684 KB | Output is correct |
48 | Correct | 32 ms | 704 KB | Output is correct |
49 | Correct | 45 ms | 920 KB | Output is correct |