# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
378250 |
2021-03-16T10:29:28 Z |
KoD |
Stations (IOI20_stations) |
C++17 |
|
1045 ms |
1176 KB |
#include <bits/stdc++.h>
#include "stations.h"
template <class T>
using Vec = std::vector<T>;
Vec<int> label(int n, int k, Vec<int> u, Vec<int> v) {
Vec<Vec<int>> graph(n);
for (int i = 0; i < n - 1; ++i) {
graph[u[i]].push_back(v[i]);
graph[v[i]].push_back(u[i]);
}
int time = 0;
Vec<int> ret(n);
auto dfs = [&](auto dfs, const int u, const int p, const int d) -> void {
const auto in = time++;
for (const auto v: graph[u]) {
if (v != p) {
dfs(dfs, v, u, d + 1);
}
}
const auto out = time++;
ret[u] = (d % 2 == 0 ? in : out);
};
dfs(dfs, 0, -1, 0);
return ret;
}
int find_next_station(int s, int t, Vec<int> c) {
if (c.size() == 1) {
return c[0];
}
std::sort(c.begin(), c.end());
if (s == 0) {
return *std::lower_bound(c.begin(), c.end(), t);
}
if (s < c.front()) {
const auto p = c.back();
c.pop_back();
if (s < t && t <= c.back()) {
return *std::lower_bound(c.begin(), c.end(), t);
}
else {
return p;
}
}
else {
const auto p = c.front();
c.erase(c.begin());
if (c.front() <= t && t < s) {
return *std::prev(std::upper_bound(c.begin(), c.end(), t));
}
else {
return p;
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
492 KB |
Invalid labels (values out of range). scenario=2, k=1000, vertex=1, label=1990 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
456 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1022 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
467 ms |
884 KB |
Output is correct |
2 |
Correct |
547 ms |
884 KB |
Output is correct |
3 |
Correct |
955 ms |
756 KB |
Output is correct |
4 |
Correct |
680 ms |
864 KB |
Output is correct |
5 |
Correct |
673 ms |
756 KB |
Output is correct |
6 |
Correct |
505 ms |
884 KB |
Output is correct |
7 |
Correct |
666 ms |
864 KB |
Output is correct |
8 |
Correct |
2 ms |
756 KB |
Output is correct |
9 |
Correct |
5 ms |
756 KB |
Output is correct |
10 |
Correct |
2 ms |
868 KB |
Output is correct |
11 |
Correct |
696 ms |
1012 KB |
Output is correct |
12 |
Correct |
573 ms |
988 KB |
Output is correct |
13 |
Correct |
477 ms |
1176 KB |
Output is correct |
14 |
Correct |
504 ms |
796 KB |
Output is correct |
15 |
Correct |
54 ms |
736 KB |
Output is correct |
16 |
Correct |
75 ms |
820 KB |
Output is correct |
17 |
Correct |
112 ms |
784 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1045 ms |
736 KB |
Output is correct |
2 |
Correct |
681 ms |
736 KB |
Output is correct |
3 |
Correct |
718 ms |
736 KB |
Output is correct |
4 |
Correct |
3 ms |
868 KB |
Output is correct |
5 |
Correct |
5 ms |
756 KB |
Output is correct |
6 |
Correct |
2 ms |
876 KB |
Output is correct |
7 |
Correct |
690 ms |
736 KB |
Output is correct |
8 |
Correct |
1035 ms |
896 KB |
Output is correct |
9 |
Correct |
661 ms |
1060 KB |
Output is correct |
10 |
Correct |
675 ms |
1044 KB |
Output is correct |
11 |
Correct |
6 ms |
868 KB |
Output is correct |
12 |
Correct |
7 ms |
736 KB |
Output is correct |
13 |
Correct |
5 ms |
756 KB |
Output is correct |
14 |
Correct |
3 ms |
756 KB |
Output is correct |
15 |
Correct |
2 ms |
876 KB |
Output is correct |
16 |
Correct |
596 ms |
756 KB |
Output is correct |
17 |
Correct |
492 ms |
756 KB |
Output is correct |
18 |
Correct |
585 ms |
756 KB |
Output is correct |
19 |
Correct |
605 ms |
756 KB |
Output is correct |
20 |
Correct |
616 ms |
756 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
601 ms |
876 KB |
Partially correct |
2 |
Partially correct |
587 ms |
884 KB |
Partially correct |
3 |
Correct |
877 ms |
864 KB |
Output is correct |
4 |
Correct |
675 ms |
736 KB |
Output is correct |
5 |
Correct |
660 ms |
756 KB |
Output is correct |
6 |
Partially correct |
517 ms |
884 KB |
Partially correct |
7 |
Partially correct |
537 ms |
996 KB |
Partially correct |
8 |
Correct |
3 ms |
736 KB |
Output is correct |
9 |
Correct |
4 ms |
916 KB |
Output is correct |
10 |
Correct |
2 ms |
736 KB |
Output is correct |
11 |
Partially correct |
452 ms |
780 KB |
Partially correct |
12 |
Partially correct |
592 ms |
756 KB |
Partially correct |
13 |
Correct |
923 ms |
736 KB |
Output is correct |
14 |
Correct |
683 ms |
756 KB |
Output is correct |
15 |
Correct |
687 ms |
868 KB |
Output is correct |
16 |
Partially correct |
465 ms |
736 KB |
Partially correct |
17 |
Correct |
519 ms |
868 KB |
Output is correct |
18 |
Partially correct |
432 ms |
976 KB |
Partially correct |
19 |
Partially correct |
516 ms |
864 KB |
Partially correct |
20 |
Partially correct |
434 ms |
916 KB |
Partially correct |
21 |
Correct |
57 ms |
860 KB |
Output is correct |
22 |
Partially correct |
71 ms |
736 KB |
Partially correct |
23 |
Partially correct |
119 ms |
916 KB |
Partially correct |
24 |
Correct |
6 ms |
868 KB |
Output is correct |
25 |
Correct |
6 ms |
756 KB |
Output is correct |
26 |
Correct |
6 ms |
868 KB |
Output is correct |
27 |
Correct |
5 ms |
868 KB |
Output is correct |
28 |
Correct |
2 ms |
1008 KB |
Output is correct |
29 |
Correct |
510 ms |
756 KB |
Output is correct |
30 |
Correct |
471 ms |
1012 KB |
Output is correct |
31 |
Correct |
635 ms |
868 KB |
Output is correct |
32 |
Correct |
569 ms |
868 KB |
Output is correct |
33 |
Correct |
603 ms |
868 KB |
Output is correct |
34 |
Partially correct |
385 ms |
1012 KB |
Partially correct |
35 |
Partially correct |
481 ms |
996 KB |
Partially correct |
36 |
Partially correct |
546 ms |
1140 KB |
Partially correct |
37 |
Partially correct |
516 ms |
1088 KB |
Partially correct |
38 |
Partially correct |
514 ms |
936 KB |
Partially correct |
39 |
Partially correct |
483 ms |
1072 KB |
Partially correct |
40 |
Partially correct |
538 ms |
1004 KB |
Partially correct |
41 |
Partially correct |
560 ms |
984 KB |
Partially correct |
42 |
Partially correct |
65 ms |
864 KB |
Partially correct |
43 |
Partially correct |
120 ms |
736 KB |
Partially correct |
44 |
Partially correct |
172 ms |
756 KB |
Partially correct |
45 |
Partially correct |
162 ms |
756 KB |
Partially correct |
46 |
Partially correct |
347 ms |
736 KB |
Partially correct |
47 |
Partially correct |
313 ms |
864 KB |
Partially correct |
48 |
Partially correct |
82 ms |
736 KB |
Partially correct |
49 |
Partially correct |
76 ms |
844 KB |
Partially correct |