# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
420345 | 2021-06-08T09:56:29 Z | NintsiChkhaidze | Stations (IOI20_stations) | C++14 | 1073 ms | 840 KB |
#include "stations.h" #include <bits/stdc++.h> //#include <iostream> //#include <vector> #define pb push_back using namespace std; vector <int> vec[1005],labels; int cnt = 0,in[1005],out[1005]; void dfs(int x,int p,int t){ in[x] = cnt++; if (t%2) labels[x] = in[x]; for (int j=0;j<vec[x].size();j++){ int to = vec[x][j]; if (to == p) continue; dfs(to,x,t + 1); } out[x] = cnt++; if (!labels[x]) labels[x] = out[x]; } vector<int> label(int n, int k, vector<int> u, vector<int> v) { for (int i=0;i<1001;i++){ vec[i].clear(); in[i] = out[i] = 0; } for (int i=0;i<u.size();i++){ vec[u[i]].pb(v[i]); vec[v[i]].pb(u[i]); } cnt=0; labels.clear(); for (int i=0;i<n;i++) labels.pb(0); dfs(0,0,0); return labels; } int find_next_station(int s, int t, vector<int> c) { sort(c.begin(),c.end()); if (s > c[0]){ //s - out for (int i = 1; i<c.size();i++){ int l = c[i],r = s - 1; if (i!=c.size() - 1) r = c[i + 1] - 1; if (l <= t && t <= r) return c[i]; } return c[0]; } else{ //s - in for (int i = 0; i<c.size() - 1; i++){ int l = s + 1,r = c[i]; if (i) l = c[i - 1] + 1; if (l <= t && t <= r) return c[i]; } return c.back(); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 436 KB | Invalid labels (values out of range). scenario=2, k=1000, vertex=0, label=1995 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 312 KB | Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=1991 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 652 ms | 636 KB | Output is correct |
2 | Correct | 589 ms | 784 KB | Output is correct |
3 | Correct | 1073 ms | 696 KB | Output is correct |
4 | Correct | 685 ms | 400 KB | Output is correct |
5 | Correct | 679 ms | 564 KB | Output is correct |
6 | Correct | 515 ms | 640 KB | Output is correct |
7 | Correct | 492 ms | 564 KB | Output is correct |
8 | Correct | 3 ms | 596 KB | Output is correct |
9 | Correct | 5 ms | 468 KB | Output is correct |
10 | Correct | 2 ms | 468 KB | Output is correct |
11 | Correct | 641 ms | 400 KB | Output is correct |
12 | Correct | 475 ms | 728 KB | Output is correct |
13 | Correct | 443 ms | 736 KB | Output is correct |
14 | Correct | 534 ms | 520 KB | Output is correct |
15 | Correct | 59 ms | 528 KB | Output is correct |
16 | Correct | 88 ms | 556 KB | Output is correct |
17 | Correct | 139 ms | 528 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 886 ms | 416 KB | Output is correct |
2 | Correct | 743 ms | 512 KB | Output is correct |
3 | Correct | 693 ms | 400 KB | Output is correct |
4 | Correct | 2 ms | 468 KB | Output is correct |
5 | Correct | 6 ms | 480 KB | Output is correct |
6 | Correct | 2 ms | 644 KB | Output is correct |
7 | Correct | 664 ms | 512 KB | Output is correct |
8 | Correct | 1053 ms | 572 KB | Output is correct |
9 | Correct | 861 ms | 400 KB | Output is correct |
10 | Correct | 603 ms | 400 KB | Output is correct |
11 | Correct | 5 ms | 468 KB | Output is correct |
12 | Correct | 7 ms | 468 KB | Output is correct |
13 | Correct | 6 ms | 468 KB | Output is correct |
14 | Correct | 4 ms | 468 KB | Output is correct |
15 | Correct | 2 ms | 468 KB | Output is correct |
16 | Correct | 537 ms | 516 KB | Output is correct |
17 | Correct | 603 ms | 516 KB | Output is correct |
18 | Correct | 634 ms | 400 KB | Output is correct |
19 | Correct | 516 ms | 428 KB | Output is correct |
20 | Correct | 477 ms | 400 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 626 ms | 652 KB | Partially correct |
2 | Partially correct | 604 ms | 760 KB | Partially correct |
3 | Correct | 867 ms | 400 KB | Output is correct |
4 | Correct | 758 ms | 400 KB | Output is correct |
5 | Correct | 614 ms | 528 KB | Output is correct |
6 | Partially correct | 537 ms | 780 KB | Partially correct |
7 | Partially correct | 489 ms | 668 KB | Partially correct |
8 | Correct | 2 ms | 468 KB | Output is correct |
9 | Correct | 4 ms | 476 KB | Output is correct |
10 | Correct | 2 ms | 476 KB | Output is correct |
11 | Partially correct | 503 ms | 528 KB | Partially correct |
12 | Partially correct | 582 ms | 528 KB | Partially correct |
13 | Correct | 940 ms | 400 KB | Output is correct |
14 | Correct | 777 ms | 564 KB | Output is correct |
15 | Correct | 691 ms | 652 KB | Output is correct |
16 | Partially correct | 476 ms | 528 KB | Partially correct |
17 | Correct | 585 ms | 512 KB | Output is correct |
18 | Partially correct | 530 ms | 752 KB | Partially correct |
19 | Partially correct | 612 ms | 744 KB | Partially correct |
20 | Partially correct | 574 ms | 516 KB | Partially correct |
21 | Correct | 70 ms | 528 KB | Output is correct |
22 | Partially correct | 76 ms | 732 KB | Partially correct |
23 | Partially correct | 114 ms | 732 KB | Partially correct |
24 | Correct | 7 ms | 540 KB | Output is correct |
25 | Correct | 7 ms | 464 KB | Output is correct |
26 | Correct | 6 ms | 468 KB | Output is correct |
27 | Correct | 4 ms | 632 KB | Output is correct |
28 | Correct | 2 ms | 468 KB | Output is correct |
29 | Correct | 659 ms | 400 KB | Output is correct |
30 | Correct | 623 ms | 588 KB | Output is correct |
31 | Correct | 615 ms | 516 KB | Output is correct |
32 | Correct | 475 ms | 516 KB | Output is correct |
33 | Correct | 571 ms | 516 KB | Output is correct |
34 | Partially correct | 423 ms | 628 KB | Partially correct |
35 | Partially correct | 450 ms | 636 KB | Partially correct |
36 | Partially correct | 448 ms | 632 KB | Partially correct |
37 | Partially correct | 474 ms | 548 KB | Partially correct |
38 | Partially correct | 498 ms | 740 KB | Partially correct |
39 | Partially correct | 464 ms | 752 KB | Partially correct |
40 | Partially correct | 440 ms | 636 KB | Partially correct |
41 | Partially correct | 528 ms | 636 KB | Partially correct |
42 | Partially correct | 69 ms | 528 KB | Partially correct |
43 | Partially correct | 106 ms | 556 KB | Partially correct |
44 | Partially correct | 149 ms | 532 KB | Partially correct |
45 | Partially correct | 158 ms | 528 KB | Partially correct |
46 | Partially correct | 317 ms | 528 KB | Partially correct |
47 | Partially correct | 341 ms | 528 KB | Partially correct |
48 | Partially correct | 65 ms | 656 KB | Partially correct |
49 | Partially correct | 54 ms | 840 KB | Partially correct |