# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1037896 | 2024-07-29T09:54:29 Z | Zicrus | Longest Trip (IOI23_longesttrip) | C++17 | 911 ms | 1584 KB |
#include <bits/stdc++.h> #include "longesttrip.h" using namespace std; typedef long long ll; vector<vector<ll>> adj; vector<bool> vst; mt19937 mt; vector<int> mxRand() { ll n = adj.size(); ll start = mt() % n; ll cur = start; vector<int> res = {(int)start}; loop: vst[cur] = true; shuffle(adj[cur].begin(), adj[cur].end(), mt); for (auto &e : adj[cur]) { if (!vst[e]) { cur = e; res.push_back(e); goto loop; } } for (auto &e : res) vst[e] = false; return res; } vector<int> longest_trip(int n, int d) { mt = mt19937(time(0)); adj = vector<vector<ll>>(n); vst = vector<bool>(n); for (int i = 0; i < n; i++) { for (int j = i+1; j < n; j++) { if (are_connected({i}, {j})) { adj[i].push_back(j); adj[j].push_back(i); } } } vector<int> res; ll comp = n <= 100 ? 150 : 50; if (n <= 50) comp = 300; for (int i = 0; i < 50; i++) { vector<int> nw = mxRand(); if (nw.size() > res.size()) res = nw; } return res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 204 ms | 1288 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 344 KB | Output is correct |
2 | Correct | 35 ms | 344 KB | Output is correct |
3 | Correct | 158 ms | 604 KB | Output is correct |
4 | Correct | 410 ms | 740 KB | Output is correct |
5 | Correct | 852 ms | 996 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 344 KB | Output is correct |
2 | Correct | 25 ms | 344 KB | Output is correct |
3 | Correct | 157 ms | 472 KB | Output is correct |
4 | Correct | 432 ms | 1032 KB | Output is correct |
5 | Correct | 892 ms | 1320 KB | Output is correct |
6 | Correct | 11 ms | 344 KB | Output is correct |
7 | Correct | 28 ms | 344 KB | Output is correct |
8 | Correct | 167 ms | 468 KB | Output is correct |
9 | Correct | 311 ms | 864 KB | Output is correct |
10 | Correct | 911 ms | 1440 KB | Output is correct |
11 | Correct | 898 ms | 1568 KB | Output is correct |
12 | Correct | 832 ms | 1156 KB | Output is correct |
13 | Correct | 796 ms | 1536 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 344 KB | Output is correct |
2 | Correct | 19 ms | 344 KB | Output is correct |
3 | Correct | 133 ms | 476 KB | Output is correct |
4 | Correct | 335 ms | 580 KB | Output is correct |
5 | Correct | 738 ms | 996 KB | Output is correct |
6 | Correct | 9 ms | 344 KB | Output is correct |
7 | Correct | 27 ms | 344 KB | Output is correct |
8 | Correct | 129 ms | 484 KB | Output is correct |
9 | Correct | 283 ms | 556 KB | Output is correct |
10 | Correct | 670 ms | 1264 KB | Output is correct |
11 | Correct | 755 ms | 1016 KB | Output is correct |
12 | Correct | 708 ms | 1212 KB | Output is correct |
13 | Correct | 738 ms | 1020 KB | Output is correct |
14 | Correct | 9 ms | 344 KB | Output is correct |
15 | Correct | 13 ms | 344 KB | Output is correct |
16 | Correct | 33 ms | 344 KB | Output is correct |
17 | Correct | 75 ms | 436 KB | Output is correct |
18 | Correct | 147 ms | 852 KB | Output is correct |
19 | Correct | 316 ms | 752 KB | Output is correct |
20 | Correct | 257 ms | 716 KB | Output is correct |
21 | Correct | 713 ms | 1260 KB | Output is correct |
22 | Correct | 746 ms | 1336 KB | Output is correct |
23 | Correct | 776 ms | 1168 KB | Output is correct |
24 | Correct | 747 ms | 1512 KB | Output is correct |
25 | Correct | 9 ms | 344 KB | Output is correct |
26 | Correct | 8 ms | 344 KB | Output is correct |
27 | Correct | 25 ms | 344 KB | Output is correct |
28 | Correct | 25 ms | 344 KB | Output is correct |
29 | Correct | 18 ms | 344 KB | Output is correct |
30 | Correct | 173 ms | 476 KB | Output is correct |
31 | Correct | 182 ms | 464 KB | Output is correct |
32 | Correct | 159 ms | 596 KB | Output is correct |
33 | Correct | 311 ms | 548 KB | Output is correct |
34 | Correct | 243 ms | 544 KB | Output is correct |
35 | Correct | 289 ms | 696 KB | Output is correct |
36 | Correct | 750 ms | 1368 KB | Output is correct |
37 | Correct | 741 ms | 1060 KB | Output is correct |
38 | Correct | 755 ms | 1244 KB | Output is correct |
39 | Correct | 767 ms | 928 KB | Output is correct |
40 | Correct | 694 ms | 1320 KB | Output is correct |
41 | Correct | 729 ms | 920 KB | Output is correct |
42 | Correct | 743 ms | 892 KB | Output is correct |
43 | Correct | 718 ms | 1140 KB | Output is correct |
44 | Correct | 754 ms | 1192 KB | Output is correct |
45 | Correct | 14 ms | 344 KB | Output is correct |
46 | Correct | 9 ms | 344 KB | Output is correct |
47 | Correct | 18 ms | 344 KB | Output is correct |
48 | Correct | 27 ms | 344 KB | Output is correct |
49 | Correct | 16 ms | 344 KB | Output is correct |
50 | Correct | 179 ms | 480 KB | Output is correct |
51 | Correct | 165 ms | 344 KB | Output is correct |
52 | Correct | 175 ms | 468 KB | Output is correct |
53 | Correct | 325 ms | 544 KB | Output is correct |
54 | Correct | 289 ms | 544 KB | Output is correct |
55 | Correct | 296 ms | 792 KB | Output is correct |
56 | Correct | 790 ms | 1336 KB | Output is correct |
57 | Correct | 768 ms | 1120 KB | Output is correct |
58 | Correct | 656 ms | 1044 KB | Output is correct |
59 | Correct | 761 ms | 1052 KB | Output is correct |
60 | Correct | 659 ms | 1084 KB | Output is correct |
61 | Correct | 665 ms | 784 KB | Output is correct |
62 | Correct | 628 ms | 912 KB | Output is correct |
63 | Correct | 760 ms | 876 KB | Output is correct |
64 | Correct | 772 ms | 1584 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 344 KB | Output is correct |
2 | Correct | 24 ms | 344 KB | Output is correct |
3 | Partially correct | 149 ms | 732 KB | Output is partially correct |
4 | Partially correct | 382 ms | 788 KB | Output is partially correct |
5 | Partially correct | 839 ms | 1236 KB | Output is partially correct |
6 | Correct | 12 ms | 344 KB | Output is correct |
7 | Correct | 25 ms | 344 KB | Output is correct |
8 | Partially correct | 152 ms | 344 KB | Output is partially correct |
9 | Partially correct | 341 ms | 944 KB | Output is partially correct |
10 | Partially correct | 828 ms | 1092 KB | Output is partially correct |
11 | Partially correct | 829 ms | 1092 KB | Output is partially correct |
12 | Partially correct | 885 ms | 1432 KB | Output is partially correct |
13 | Partially correct | 891 ms | 1336 KB | Output is partially correct |
14 | Correct | 8 ms | 344 KB | Output is correct |
15 | Correct | 13 ms | 344 KB | Output is correct |
16 | Correct | 41 ms | 344 KB | Output is correct |
17 | Partially correct | 100 ms | 344 KB | Output is partially correct |
18 | Partially correct | 178 ms | 472 KB | Output is partially correct |
19 | Partially correct | 342 ms | 568 KB | Output is partially correct |
20 | Partially correct | 318 ms | 556 KB | Output is partially correct |
21 | Correct | 11 ms | 344 KB | Output is correct |
22 | Correct | 12 ms | 344 KB | Output is correct |
23 | Correct | 28 ms | 344 KB | Output is correct |
24 | Correct | 25 ms | 344 KB | Output is correct |
25 | Correct | 29 ms | 344 KB | Output is correct |
26 | Partially correct | 222 ms | 476 KB | Output is partially correct |
27 | Partially correct | 203 ms | 468 KB | Output is partially correct |
28 | Partially correct | 170 ms | 600 KB | Output is partially correct |
29 | Partially correct | 297 ms | 600 KB | Output is partially correct |
30 | Partially correct | 337 ms | 548 KB | Output is partially correct |
31 | Partially correct | 328 ms | 756 KB | Output is partially correct |
32 | Correct | 11 ms | 344 KB | Output is correct |
33 | Correct | 15 ms | 344 KB | Output is correct |
34 | Correct | 26 ms | 344 KB | Output is correct |
35 | Correct | 30 ms | 344 KB | Output is correct |
36 | Correct | 23 ms | 344 KB | Output is correct |
37 | Incorrect | 145 ms | 716 KB | Incorrect |
38 | Halted | 0 ms | 0 KB | - |