# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
839901 | 2023-08-30T20:35:02 Z | emeraldblock | Longest Trip (IOI23_longesttrip) | C++17 | 197 ms | 568 KB |
#include <bits/stdc++.h> #include "longesttrip.h" using namespace std; std::vector<int> longest_trip(int N, int D) { vector<int> path{0}; vector<int> rest(N-1); iota(rest.begin(),rest.end(),1); while (rest.size()) { bool can = are_connected(path,rest); if (!can) { if (path.size() >= rest.size()) return path; return rest; } int lo = 0, hi = rest.size(); while (hi-lo > 1) { int mid = (lo+hi)/2; vector<int> cand; for (auto it = rest.begin()+lo; it != rest.begin()+mid; ++it) { cand.push_back(*it); } bool res = are_connected(path,cand); if (res) { hi = mid; } else { lo = mid; } } int nxt = rest[lo]; rest.erase(rest.begin()+lo); if (are_connected({path.back()},{nxt})) { path.push_back(nxt); } else { lo = 0; hi = path.size(); while (hi-lo > 1) { int mid = (lo+hi)/2; vector<int> cand; for (auto it = path.begin()+lo; it != path.begin()+mid; ++it) { cand.push_back(*it); } bool res = are_connected(cand,{nxt}); if (res) { hi = mid; } else { lo = mid; } } if (lo == 0) { path.insert(path.begin(),nxt); } else { rotate(path.begin(),path.begin()+lo+1,path.end()); path.push_back(nxt); } } } return path; }
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 36 ms | 324 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 14 ms | 208 KB | Output is correct |
2 | Correct | 28 ms | 208 KB | Output is correct |
3 | Correct | 56 ms | 208 KB | Output is correct |
4 | Correct | 80 ms | 208 KB | Output is correct |
5 | Correct | 127 ms | 320 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 18 ms | 208 KB | Output is correct |
2 | Correct | 23 ms | 208 KB | Output is correct |
3 | Correct | 55 ms | 208 KB | Output is correct |
4 | Correct | 80 ms | 208 KB | Output is correct |
5 | Correct | 109 ms | 376 KB | Output is correct |
6 | Correct | 15 ms | 208 KB | Output is correct |
7 | Correct | 28 ms | 208 KB | Output is correct |
8 | Correct | 47 ms | 208 KB | Output is correct |
9 | Correct | 67 ms | 300 KB | Output is correct |
10 | Correct | 125 ms | 328 KB | Output is correct |
11 | Correct | 119 ms | 208 KB | Output is correct |
12 | Correct | 138 ms | 208 KB | Output is correct |
13 | Correct | 120 ms | 320 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 208 KB | Output is correct |
2 | Correct | 22 ms | 208 KB | Output is correct |
3 | Correct | 45 ms | 208 KB | Output is correct |
4 | Correct | 66 ms | 332 KB | Output is correct |
5 | Correct | 127 ms | 316 KB | Output is correct |
6 | Correct | 15 ms | 208 KB | Output is correct |
7 | Correct | 23 ms | 208 KB | Output is correct |
8 | Correct | 51 ms | 304 KB | Output is correct |
9 | Correct | 68 ms | 208 KB | Output is correct |
10 | Correct | 130 ms | 324 KB | Output is correct |
11 | Correct | 131 ms | 208 KB | Output is correct |
12 | Correct | 124 ms | 208 KB | Output is correct |
13 | Correct | 127 ms | 312 KB | Output is correct |
14 | Correct | 9 ms | 208 KB | Output is correct |
15 | Correct | 12 ms | 260 KB | Output is correct |
16 | Correct | 35 ms | 208 KB | Output is correct |
17 | Correct | 48 ms | 208 KB | Output is correct |
18 | Correct | 58 ms | 208 KB | Output is correct |
19 | Correct | 94 ms | 208 KB | Output is correct |
20 | Correct | 71 ms | 208 KB | Output is correct |
21 | Correct | 127 ms | 320 KB | Output is correct |
22 | Correct | 129 ms | 336 KB | Output is correct |
23 | Correct | 139 ms | 208 KB | Output is correct |
24 | Correct | 133 ms | 312 KB | Output is correct |
25 | Correct | 11 ms | 208 KB | Output is correct |
26 | Correct | 10 ms | 208 KB | Output is correct |
27 | Correct | 23 ms | 208 KB | Output is correct |
28 | Correct | 23 ms | 208 KB | Output is correct |
29 | Correct | 29 ms | 208 KB | Output is correct |
30 | Correct | 52 ms | 208 KB | Output is correct |
31 | Correct | 42 ms | 208 KB | Output is correct |
32 | Correct | 31 ms | 208 KB | Output is correct |
33 | Correct | 49 ms | 208 KB | Output is correct |
34 | Correct | 76 ms | 208 KB | Output is correct |
35 | Correct | 68 ms | 208 KB | Output is correct |
36 | Correct | 124 ms | 332 KB | Output is correct |
37 | Correct | 127 ms | 320 KB | Output is correct |
38 | Correct | 117 ms | 208 KB | Output is correct |
39 | Correct | 90 ms | 308 KB | Output is correct |
40 | Correct | 77 ms | 312 KB | Output is correct |
41 | Correct | 61 ms | 208 KB | Output is correct |
42 | Correct | 63 ms | 208 KB | Output is correct |
43 | Correct | 65 ms | 336 KB | Output is correct |
44 | Correct | 58 ms | 208 KB | Output is correct |
45 | Correct | 17 ms | 208 KB | Output is correct |
46 | Correct | 19 ms | 208 KB | Output is correct |
47 | Correct | 30 ms | 208 KB | Output is correct |
48 | Correct | 29 ms | 208 KB | Output is correct |
49 | Correct | 30 ms | 208 KB | Output is correct |
50 | Correct | 65 ms | 208 KB | Output is correct |
51 | Correct | 64 ms | 208 KB | Output is correct |
52 | Correct | 56 ms | 208 KB | Output is correct |
53 | Correct | 83 ms | 208 KB | Output is correct |
54 | Correct | 87 ms | 208 KB | Output is correct |
55 | Correct | 83 ms | 208 KB | Output is correct |
56 | Correct | 136 ms | 208 KB | Output is correct |
57 | Correct | 148 ms | 432 KB | Output is correct |
58 | Correct | 146 ms | 308 KB | Output is correct |
59 | Correct | 130 ms | 308 KB | Output is correct |
60 | Correct | 145 ms | 456 KB | Output is correct |
61 | Correct | 153 ms | 320 KB | Output is correct |
62 | Correct | 134 ms | 456 KB | Output is correct |
63 | Correct | 145 ms | 320 KB | Output is correct |
64 | Correct | 135 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 208 KB | Output is correct |
2 | Correct | 25 ms | 208 KB | Output is correct |
3 | Correct | 50 ms | 208 KB | Output is correct |
4 | Partially correct | 88 ms | 208 KB | Output is partially correct |
5 | Partially correct | 131 ms | 316 KB | Output is partially correct |
6 | Correct | 15 ms | 208 KB | Output is correct |
7 | Correct | 26 ms | 208 KB | Output is correct |
8 | Correct | 49 ms | 208 KB | Output is correct |
9 | Partially correct | 70 ms | 208 KB | Output is partially correct |
10 | Partially correct | 119 ms | 208 KB | Output is partially correct |
11 | Partially correct | 146 ms | 316 KB | Output is partially correct |
12 | Partially correct | 124 ms | 208 KB | Output is partially correct |
13 | Partially correct | 132 ms | 324 KB | Output is partially correct |
14 | Correct | 12 ms | 208 KB | Output is correct |
15 | Correct | 16 ms | 208 KB | Output is correct |
16 | Correct | 45 ms | 208 KB | Output is correct |
17 | Correct | 60 ms | 208 KB | Output is correct |
18 | Correct | 50 ms | 208 KB | Output is correct |
19 | Partially correct | 73 ms | 308 KB | Output is partially correct |
20 | Partially correct | 73 ms | 208 KB | Output is partially correct |
21 | Correct | 12 ms | 248 KB | Output is correct |
22 | Correct | 10 ms | 208 KB | Output is correct |
23 | Correct | 30 ms | 208 KB | Output is correct |
24 | Correct | 31 ms | 208 KB | Output is correct |
25 | Correct | 30 ms | 208 KB | Output is correct |
26 | Partially correct | 67 ms | 208 KB | Output is partially correct |
27 | Correct | 53 ms | 208 KB | Output is correct |
28 | Correct | 40 ms | 208 KB | Output is correct |
29 | Partially correct | 79 ms | 208 KB | Output is partially correct |
30 | Partially correct | 81 ms | 208 KB | Output is partially correct |
31 | Partially correct | 56 ms | 336 KB | Output is partially correct |
32 | Correct | 17 ms | 208 KB | Output is correct |
33 | Correct | 17 ms | 208 KB | Output is correct |
34 | Correct | 39 ms | 332 KB | Output is correct |
35 | Correct | 35 ms | 208 KB | Output is correct |
36 | Correct | 35 ms | 208 KB | Output is correct |
37 | Partially correct | 87 ms | 336 KB | Output is partially correct |
38 | Partially correct | 60 ms | 208 KB | Output is partially correct |
39 | Partially correct | 81 ms | 208 KB | Output is partially correct |
40 | Partially correct | 101 ms | 208 KB | Output is partially correct |
41 | Partially correct | 104 ms | 208 KB | Output is partially correct |
42 | Partially correct | 80 ms | 300 KB | Output is partially correct |
43 | Partially correct | 153 ms | 320 KB | Output is partially correct |
44 | Partially correct | 141 ms | 320 KB | Output is partially correct |
45 | Partially correct | 158 ms | 208 KB | Output is partially correct |
46 | Partially correct | 153 ms | 384 KB | Output is partially correct |
47 | Partially correct | 151 ms | 208 KB | Output is partially correct |
48 | Partially correct | 144 ms | 208 KB | Output is partially correct |
49 | Partially correct | 118 ms | 208 KB | Output is partially correct |
50 | Partially correct | 97 ms | 308 KB | Output is partially correct |
51 | Partially correct | 74 ms | 340 KB | Output is partially correct |
52 | Partially correct | 71 ms | 308 KB | Output is partially correct |
53 | Partially correct | 60 ms | 320 KB | Output is partially correct |
54 | Partially correct | 59 ms | 308 KB | Output is partially correct |
55 | Partially correct | 73 ms | 336 KB | Output is partially correct |
56 | Partially correct | 140 ms | 208 KB | Output is partially correct |
57 | Partially correct | 90 ms | 208 KB | Output is partially correct |
58 | Partially correct | 76 ms | 208 KB | Output is partially correct |
59 | Partially correct | 67 ms | 312 KB | Output is partially correct |
60 | Partially correct | 50 ms | 352 KB | Output is partially correct |
61 | Partially correct | 76 ms | 208 KB | Output is partially correct |
62 | Partially correct | 162 ms | 448 KB | Output is partially correct |
63 | Partially correct | 168 ms | 316 KB | Output is partially correct |
64 | Partially correct | 135 ms | 312 KB | Output is partially correct |
65 | Partially correct | 147 ms | 312 KB | Output is partially correct |
66 | Partially correct | 180 ms | 316 KB | Output is partially correct |
67 | Partially correct | 154 ms | 316 KB | Output is partially correct |
68 | Partially correct | 186 ms | 312 KB | Output is partially correct |
69 | Partially correct | 174 ms | 208 KB | Output is partially correct |
70 | Partially correct | 152 ms | 444 KB | Output is partially correct |
71 | Partially correct | 154 ms | 316 KB | Output is partially correct |
72 | Partially correct | 153 ms | 208 KB | Output is partially correct |
73 | Partially correct | 167 ms | 448 KB | Output is partially correct |
74 | Partially correct | 153 ms | 336 KB | Output is partially correct |
75 | Partially correct | 152 ms | 316 KB | Output is partially correct |
76 | Partially correct | 162 ms | 312 KB | Output is partially correct |
77 | Partially correct | 166 ms | 568 KB | Output is partially correct |
78 | Partially correct | 150 ms | 208 KB | Output is partially correct |
79 | Partially correct | 197 ms | 312 KB | Output is partially correct |
80 | Partially correct | 141 ms | 336 KB | Output is partially correct |
81 | Partially correct | 158 ms | 208 KB | Output is partially correct |
82 | Partially correct | 159 ms | 208 KB | Output is partially correct |