# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1080883 | 2024-08-29T15:40:58 Z | asdasdqwer | Longest Trip (IOI23_longesttrip) | C++17 | 936 ms | 1884 KB |
#include "longesttrip.h" #include <bits/stdc++.h> using namespace std; std::vector<int> longest_trip(int N, int D) { vector<vector<int>> g(N); if (D == 3) { vector<int> v; for (int i=0;i<N;i++) { v.push_back(i); } return v; } for (int i=0;i<N;i++) { for (int j=i+1;j<N;j++) { if (are_connected({i}, {j})) { g[i].push_back(j); g[j].push_back(i); } } } int tries = 20; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); vector<int> lng; for (int i=0;i<tries;i++) { vector<int> tmp; vector<bool> vis(N, false); function<void(int)> dfs=[&](int node) { vis[node] = true; tmp.push_back(node); vector<int> suf; for (int j=0;j<g[node].size();j++)suf.push_back(j); shuffle(suf.begin(), suf.end(), rng); for (int x:suf) { if (!vis[g[node][x]]) { dfs(g[node][x]); break; } } }; dfs(uniform_int_distribution<int>(0, N-1)(rng)); if (lng.size() < tmp.size()) { lng = tmp; } } return lng; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 205 ms | 1884 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 344 KB | Output is correct |
2 | Correct | 22 ms | 344 KB | Output is correct |
3 | Correct | 161 ms | 452 KB | Output is correct |
4 | Correct | 434 ms | 748 KB | Output is correct |
5 | Correct | 920 ms | 1056 KB | Output is correct |
6 | Correct | 9 ms | 344 KB | Output is correct |
7 | Correct | 26 ms | 344 KB | Output is correct |
8 | Correct | 171 ms | 472 KB | Output is correct |
9 | Correct | 329 ms | 556 KB | Output is correct |
10 | Correct | 936 ms | 1224 KB | Output is correct |
11 | Correct | 854 ms | 1308 KB | Output is correct |
12 | Correct | 901 ms | 1144 KB | Output is correct |
13 | Correct | 841 ms | 1012 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 344 KB | Output is correct |
2 | Correct | 30 ms | 344 KB | Output is correct |
3 | Correct | 183 ms | 344 KB | Output is correct |
4 | Correct | 427 ms | 936 KB | Output is correct |
5 | Correct | 833 ms | 1376 KB | Output is correct |
6 | Correct | 12 ms | 344 KB | Output is correct |
7 | Correct | 28 ms | 344 KB | Output is correct |
8 | Correct | 180 ms | 460 KB | Output is correct |
9 | Correct | 365 ms | 600 KB | Output is correct |
10 | Correct | 847 ms | 1212 KB | Output is correct |
11 | Correct | 823 ms | 1004 KB | Output is correct |
12 | Correct | 910 ms | 1136 KB | Output is correct |
13 | Correct | 894 ms | 1220 KB | Output is correct |
14 | Correct | 9 ms | 344 KB | Output is correct |
15 | Correct | 13 ms | 344 KB | Output is correct |
16 | Correct | 43 ms | 344 KB | Output is correct |
17 | Correct | 111 ms | 424 KB | Output is correct |
18 | Correct | 164 ms | 460 KB | Output is correct |
19 | Correct | 338 ms | 992 KB | Output is correct |
20 | Correct | 353 ms | 560 KB | Output is correct |
21 | Correct | 897 ms | 1296 KB | Output is correct |
22 | Correct | 864 ms | 1572 KB | Output is correct |
23 | Correct | 855 ms | 1120 KB | Output is correct |
24 | Correct | 862 ms | 1016 KB | Output is correct |
25 | Correct | 11 ms | 344 KB | Output is correct |
26 | Correct | 11 ms | 344 KB | Output is correct |
27 | Correct | 22 ms | 344 KB | Output is correct |
28 | Correct | 25 ms | 344 KB | Output is correct |
29 | Correct | 30 ms | 344 KB | Output is correct |
30 | Correct | 205 ms | 468 KB | Output is correct |
31 | Correct | 193 ms | 852 KB | Output is correct |
32 | Correct | 196 ms | 600 KB | Output is correct |
33 | Correct | 340 ms | 344 KB | Output is correct |
34 | Correct | 329 ms | 600 KB | Output is correct |
35 | Correct | 370 ms | 528 KB | Output is correct |
36 | Correct | 897 ms | 1072 KB | Output is correct |
37 | Correct | 826 ms | 1084 KB | Output is correct |
38 | Correct | 845 ms | 1104 KB | Output is correct |
39 | Correct | 816 ms | 1036 KB | Output is correct |
40 | Correct | 843 ms | 1132 KB | Output is correct |
41 | Correct | 841 ms | 952 KB | Output is correct |
42 | Correct | 810 ms | 800 KB | Output is correct |
43 | Correct | 822 ms | 1252 KB | Output is correct |
44 | Correct | 898 ms | 792 KB | Output is correct |
45 | Correct | 15 ms | 344 KB | Output is correct |
46 | Correct | 16 ms | 344 KB | Output is correct |
47 | Correct | 27 ms | 344 KB | Output is correct |
48 | Correct | 21 ms | 344 KB | Output is correct |
49 | Correct | 26 ms | 344 KB | Output is correct |
50 | Correct | 226 ms | 468 KB | Output is correct |
51 | Correct | 205 ms | 688 KB | Output is correct |
52 | Correct | 183 ms | 600 KB | Output is correct |
53 | Correct | 345 ms | 848 KB | Output is correct |
54 | Correct | 341 ms | 692 KB | Output is correct |
55 | Correct | 309 ms | 756 KB | Output is correct |
56 | Correct | 901 ms | 1104 KB | Output is correct |
57 | Correct | 840 ms | 1168 KB | Output is correct |
58 | Correct | 907 ms | 1288 KB | Output is correct |
59 | Correct | 848 ms | 1108 KB | Output is correct |
60 | Correct | 856 ms | 1272 KB | Output is correct |
61 | Correct | 823 ms | 740 KB | Output is correct |
62 | Correct | 837 ms | 860 KB | Output is correct |
63 | Correct | 875 ms | 1304 KB | Output is correct |
64 | Correct | 878 ms | 1100 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 340 KB | Output is correct |
2 | Correct | 38 ms | 344 KB | Output is correct |
3 | Partially correct | 147 ms | 344 KB | Output is partially correct |
4 | Partially correct | 430 ms | 820 KB | Output is partially correct |
5 | Partially correct | 822 ms | 1048 KB | Output is partially correct |
6 | Correct | 14 ms | 344 KB | Output is correct |
7 | Correct | 25 ms | 344 KB | Output is correct |
8 | Partially correct | 144 ms | 476 KB | Output is partially correct |
9 | Partially correct | 252 ms | 720 KB | Output is partially correct |
10 | Partially correct | 735 ms | 1008 KB | Output is partially correct |
11 | Partially correct | 810 ms | 1008 KB | Output is partially correct |
12 | Partially correct | 857 ms | 1028 KB | Output is partially correct |
13 | Partially correct | 846 ms | 1388 KB | Output is partially correct |
14 | Correct | 12 ms | 344 KB | Output is correct |
15 | Correct | 18 ms | 344 KB | Output is correct |
16 | Correct | 42 ms | 344 KB | Output is correct |
17 | Partially correct | 96 ms | 600 KB | Output is partially correct |
18 | Partially correct | 147 ms | 696 KB | Output is partially correct |
19 | Partially correct | 323 ms | 848 KB | Output is partially correct |
20 | Partially correct | 309 ms | 560 KB | Output is partially correct |
21 | Correct | 9 ms | 344 KB | Output is correct |
22 | Correct | 13 ms | 344 KB | Output is correct |
23 | Correct | 22 ms | 344 KB | Output is correct |
24 | Correct | 27 ms | 344 KB | Output is correct |
25 | Correct | 35 ms | 344 KB | Output is correct |
26 | Partially correct | 218 ms | 344 KB | Output is partially correct |
27 | Partially correct | 207 ms | 472 KB | Output is partially correct |
28 | Partially correct | 211 ms | 444 KB | Output is partially correct |
29 | Partially correct | 331 ms | 600 KB | Output is partially correct |
30 | Partially correct | 312 ms | 684 KB | Output is partially correct |
31 | Partially correct | 283 ms | 720 KB | Output is partially correct |
32 | Correct | 14 ms | 344 KB | Output is correct |
33 | Correct | 15 ms | 344 KB | Output is correct |
34 | Incorrect | 1 ms | 344 KB | Incorrect |
35 | Halted | 0 ms | 0 KB | - |