# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1080943 | 2024-08-29T16:12:56 Z | asdasdqwer | Longest Trip (IOI23_longesttrip) | C++17 | 911 ms | 1376 KB |
#pragma GCC optimize("O3") #pragma GCC target("avx,avx2,sse4") #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 = 17; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); for (int i=0;i<N;i++) { shuffle(g[i].begin(), g[i].end(), rng); } vector<int> lng; for (int i=0;i<N;i++) { vector<int> tmp; vector<bool> vis(N, false); function<void(int)> dfs=[&](int node) { vis[node] = true; tmp.push_back(node); for (int x:g[node]) { if (!vis[x]) { dfs(x); break; } } }; dfs(i); if (lng.size() < tmp.size()) { lng = tmp; } if ((D == 2 && lng.size() == N) || (D == 1 && lng.size() >= (N/2+1))) return lng; } return lng; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 344 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 1 ms | 344 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 344 KB | Output is correct |
2 | Correct | 19 ms | 344 KB | Output is correct |
3 | Correct | 138 ms | 344 KB | Output is correct |
4 | Correct | 416 ms | 496 KB | Output is correct |
5 | Correct | 841 ms | 968 KB | Output is correct |
6 | Correct | 6 ms | 344 KB | Output is correct |
7 | Correct | 22 ms | 344 KB | Output is correct |
8 | Correct | 141 ms | 588 KB | Output is correct |
9 | Correct | 327 ms | 848 KB | Output is correct |
10 | Correct | 841 ms | 948 KB | Output is correct |
11 | Correct | 821 ms | 972 KB | Output is correct |
12 | Correct | 836 ms | 1068 KB | Output is correct |
13 | Correct | 878 ms | 752 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 344 KB | Output is correct |
2 | Correct | 25 ms | 344 KB | Output is correct |
3 | Correct | 129 ms | 460 KB | Output is correct |
4 | Correct | 400 ms | 592 KB | Output is correct |
5 | Correct | 782 ms | 1004 KB | Output is correct |
6 | Correct | 7 ms | 344 KB | Output is correct |
7 | Correct | 31 ms | 344 KB | Output is correct |
8 | Correct | 156 ms | 440 KB | Output is correct |
9 | Correct | 316 ms | 600 KB | Output is correct |
10 | Correct | 850 ms | 1376 KB | Output is correct |
11 | Correct | 883 ms | 972 KB | Output is correct |
12 | Correct | 855 ms | 1300 KB | Output is correct |
13 | Correct | 827 ms | 1176 KB | Output is correct |
14 | Correct | 5 ms | 344 KB | Output is correct |
15 | Correct | 12 ms | 344 KB | Output is correct |
16 | Correct | 40 ms | 436 KB | Output is correct |
17 | Correct | 84 ms | 344 KB | Output is correct |
18 | Correct | 131 ms | 344 KB | Output is correct |
19 | Correct | 291 ms | 728 KB | Output is correct |
20 | Correct | 296 ms | 496 KB | Output is correct |
21 | Correct | 780 ms | 1316 KB | Output is correct |
22 | Correct | 861 ms | 1000 KB | Output is correct |
23 | Correct | 839 ms | 1012 KB | Output is correct |
24 | Correct | 850 ms | 1152 KB | Output is correct |
25 | Correct | 9 ms | 344 KB | Output is correct |
26 | Correct | 7 ms | 344 KB | Output is correct |
27 | Correct | 33 ms | 344 KB | Output is correct |
28 | Correct | 19 ms | 344 KB | Output is correct |
29 | Correct | 27 ms | 344 KB | Output is correct |
30 | Correct | 197 ms | 344 KB | Output is correct |
31 | Correct | 170 ms | 344 KB | Output is correct |
32 | Correct | 197 ms | 600 KB | Output is correct |
33 | Correct | 317 ms | 728 KB | Output is correct |
34 | Correct | 313 ms | 848 KB | Output is correct |
35 | Correct | 318 ms | 724 KB | Output is correct |
36 | Correct | 846 ms | 744 KB | Output is correct |
37 | Correct | 911 ms | 868 KB | Output is correct |
38 | Correct | 787 ms | 868 KB | Output is correct |
39 | Correct | 816 ms | 1120 KB | Output is correct |
40 | Correct | 776 ms | 860 KB | Output is correct |
41 | Correct | 821 ms | 600 KB | Output is correct |
42 | Correct | 839 ms | 688 KB | Output is correct |
43 | Correct | 851 ms | 1104 KB | Output is correct |
44 | Correct | 851 ms | 952 KB | Output is correct |
45 | Correct | 7 ms | 344 KB | Output is correct |
46 | Correct | 7 ms | 344 KB | Output is correct |
47 | Correct | 24 ms | 344 KB | Output is correct |
48 | Correct | 26 ms | 344 KB | Output is correct |
49 | Correct | 28 ms | 344 KB | Output is correct |
50 | Correct | 217 ms | 440 KB | Output is correct |
51 | Correct | 189 ms | 344 KB | Output is correct |
52 | Correct | 210 ms | 856 KB | Output is correct |
53 | Correct | 311 ms | 720 KB | Output is correct |
54 | Correct | 335 ms | 616 KB | Output is correct |
55 | Correct | 371 ms | 488 KB | Output is correct |
56 | Correct | 824 ms | 716 KB | Output is correct |
57 | Correct | 759 ms | 876 KB | Output is correct |
58 | Correct | 831 ms | 984 KB | Output is correct |
59 | Correct | 846 ms | 1136 KB | Output is correct |
60 | Correct | 869 ms | 852 KB | Output is correct |
61 | Correct | 879 ms | 1232 KB | Output is correct |
62 | Correct | 879 ms | 1000 KB | Output is correct |
63 | Correct | 865 ms | 1308 KB | Output is correct |
64 | Correct | 834 ms | 1132 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 344 KB | Output is correct |
2 | Correct | 30 ms | 344 KB | Output is correct |
3 | Partially correct | 146 ms | 436 KB | Output is partially correct |
4 | Partially correct | 360 ms | 712 KB | Output is partially correct |
5 | Partially correct | 791 ms | 1044 KB | Output is partially correct |
6 | Incorrect | 0 ms | 344 KB | Incorrect |
7 | Halted | 0 ms | 0 KB | - |