# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1065155 | 2024-08-19T01:31:46 Z | vjudge1 | 가장 긴 여행 (IOI23_longesttrip) | C++17 | 886 ms | 1520 KB |
#include "longesttrip.h" #include<bits/stdc++.h> using namespace std; vector<int>adj[256]; bitset<256>vis; void dfs(int n){ if(vis[n])return; vis[n]=1; for(auto i:adj[n]) dfs(i); } vector<int>path; void dfs2(int n){ path.push_back(n); vis[n]=1; for(auto i:adj[n]) if(!vis[i]) return dfs2(i); } mt19937 rng(1272842334); vector<int> longest_trip(int N, int D){ for(int i=0;i<N;i++) adj[i].clear(); for(int i=1;i<N;i++) for(int j=i;j--;) if(are_connected({i},{j})) adj[i].push_back(j), adj[j].push_back(i); vis.reset(); dfs(0); if(vis.count()!=N){ vector<int>a,b; for(int i=0;i<N;i++) if(!vis[i]) a.push_back(i); else b.push_back(i); return a.size()>b.size()?a:b; } vis.reset(); path.clear(); int nod=rng()%N; dfs2(nod); if(path.size()==N) return path; while(1) { for(auto x:adj[path[0]]) if(!vis[x]) { vector<int>v2; vis[x]=1; for(int i=0;i<N;i++) if(!vis[i])v2.push_back(i); v2.push_back(x); for(auto i:path) v2.push_back(i); return v2; } int x=path[0]; path.erase(path.begin()); path.push_back(x); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 596 KB | Output is correct |
2 | Correct | 192 ms | 948 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 344 KB | Output is correct |
2 | Correct | 25 ms | 344 KB | Output is correct |
3 | Correct | 144 ms | 596 KB | Output is correct |
4 | Correct | 407 ms | 484 KB | Output is correct |
5 | Correct | 853 ms | 1176 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 344 KB | Output is correct |
2 | Correct | 27 ms | 344 KB | Output is correct |
3 | Correct | 149 ms | 344 KB | Output is correct |
4 | Correct | 402 ms | 592 KB | Output is correct |
5 | Correct | 824 ms | 828 KB | Output is correct |
6 | Correct | 6 ms | 340 KB | Output is correct |
7 | Correct | 28 ms | 344 KB | Output is correct |
8 | Correct | 164 ms | 344 KB | Output is correct |
9 | Correct | 281 ms | 596 KB | Output is correct |
10 | Correct | 816 ms | 940 KB | Output is correct |
11 | Correct | 862 ms | 1140 KB | Output is correct |
12 | Correct | 799 ms | 1172 KB | Output is correct |
13 | Correct | 827 ms | 720 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 344 KB | Output is correct |
2 | Correct | 22 ms | 344 KB | Output is correct |
3 | Correct | 138 ms | 344 KB | Output is correct |
4 | Correct | 375 ms | 600 KB | Output is correct |
5 | Correct | 813 ms | 992 KB | Output is correct |
6 | Correct | 7 ms | 344 KB | Output is correct |
7 | Correct | 24 ms | 344 KB | Output is correct |
8 | Correct | 157 ms | 344 KB | Output is correct |
9 | Correct | 299 ms | 600 KB | Output is correct |
10 | Correct | 846 ms | 1516 KB | Output is correct |
11 | Correct | 798 ms | 1020 KB | Output is correct |
12 | Correct | 859 ms | 868 KB | Output is correct |
13 | Correct | 842 ms | 1108 KB | Output is correct |
14 | Correct | 5 ms | 344 KB | Output is correct |
15 | Correct | 13 ms | 344 KB | Output is correct |
16 | Correct | 42 ms | 344 KB | Output is correct |
17 | Correct | 87 ms | 344 KB | Output is correct |
18 | Correct | 139 ms | 460 KB | Output is correct |
19 | Correct | 281 ms | 596 KB | Output is correct |
20 | Correct | 304 ms | 952 KB | Output is correct |
21 | Correct | 873 ms | 1144 KB | Output is correct |
22 | Correct | 847 ms | 872 KB | Output is correct |
23 | Correct | 818 ms | 964 KB | Output is correct |
24 | Correct | 825 ms | 892 KB | Output is correct |
25 | Correct | 11 ms | 344 KB | Output is correct |
26 | Correct | 8 ms | 344 KB | Output is correct |
27 | Correct | 29 ms | 344 KB | Output is correct |
28 | Correct | 24 ms | 344 KB | Output is correct |
29 | Correct | 20 ms | 344 KB | Output is correct |
30 | Correct | 190 ms | 344 KB | Output is correct |
31 | Correct | 169 ms | 344 KB | Output is correct |
32 | Correct | 222 ms | 600 KB | Output is correct |
33 | Correct | 288 ms | 344 KB | Output is correct |
34 | Correct | 317 ms | 344 KB | Output is correct |
35 | Correct | 300 ms | 712 KB | Output is correct |
36 | Correct | 785 ms | 896 KB | Output is correct |
37 | Correct | 837 ms | 1204 KB | Output is correct |
38 | Correct | 781 ms | 948 KB | Output is correct |
39 | Correct | 818 ms | 1052 KB | Output is correct |
40 | Correct | 839 ms | 932 KB | Output is correct |
41 | Correct | 800 ms | 1068 KB | Output is correct |
42 | Correct | 886 ms | 848 KB | Output is correct |
43 | Correct | 797 ms | 960 KB | Output is correct |
44 | Correct | 833 ms | 904 KB | Output is correct |
45 | Correct | 6 ms | 344 KB | Output is correct |
46 | Correct | 9 ms | 344 KB | Output is correct |
47 | Correct | 32 ms | 344 KB | Output is correct |
48 | Correct | 18 ms | 344 KB | Output is correct |
49 | Correct | 18 ms | 344 KB | Output is correct |
50 | Correct | 180 ms | 344 KB | Output is correct |
51 | Correct | 213 ms | 700 KB | Output is correct |
52 | Correct | 193 ms | 344 KB | Output is correct |
53 | Correct | 291 ms | 344 KB | Output is correct |
54 | Correct | 296 ms | 344 KB | Output is correct |
55 | Correct | 286 ms | 492 KB | Output is correct |
56 | Correct | 835 ms | 744 KB | Output is correct |
57 | Correct | 802 ms | 1076 KB | Output is correct |
58 | Correct | 830 ms | 1192 KB | Output is correct |
59 | Correct | 849 ms | 1264 KB | Output is correct |
60 | Correct | 845 ms | 1208 KB | Output is correct |
61 | Correct | 801 ms | 984 KB | Output is correct |
62 | Correct | 816 ms | 1304 KB | Output is correct |
63 | Correct | 835 ms | 852 KB | Output is correct |
64 | Correct | 839 ms | 868 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 344 KB | Output is correct |
2 | Correct | 23 ms | 344 KB | Output is correct |
3 | Partially correct | 140 ms | 600 KB | Output is partially correct |
4 | Partially correct | 407 ms | 1000 KB | Output is partially correct |
5 | Partially correct | 804 ms | 1072 KB | Output is partially correct |
6 | Correct | 8 ms | 340 KB | Output is correct |
7 | Correct | 31 ms | 344 KB | Output is correct |
8 | Partially correct | 146 ms | 344 KB | Output is partially correct |
9 | Partially correct | 318 ms | 848 KB | Output is partially correct |
10 | Partially correct | 804 ms | 896 KB | Output is partially correct |
11 | Partially correct | 809 ms | 704 KB | Output is partially correct |
12 | Partially correct | 840 ms | 908 KB | Output is partially correct |
13 | Partially correct | 843 ms | 892 KB | Output is partially correct |
14 | Correct | 9 ms | 344 KB | Output is correct |
15 | Correct | 11 ms | 344 KB | Output is correct |
16 | Correct | 41 ms | 344 KB | Output is correct |
17 | Partially correct | 101 ms | 452 KB | Output is partially correct |
18 | Partially correct | 145 ms | 856 KB | Output is partially correct |
19 | Partially correct | 322 ms | 712 KB | Output is partially correct |
20 | Partially correct | 301 ms | 592 KB | Output is partially correct |
21 | Correct | 11 ms | 344 KB | Output is correct |
22 | Correct | 9 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 | 32 ms | 344 KB | Output is correct |
26 | Partially correct | 192 ms | 344 KB | Output is partially correct |
27 | Partially correct | 209 ms | 456 KB | Output is partially correct |
28 | Partially correct | 199 ms | 344 KB | Output is partially correct |
29 | Partially correct | 292 ms | 1480 KB | Output is partially correct |
30 | Partially correct | 298 ms | 444 KB | Output is partially correct |
31 | Partially correct | 301 ms | 632 KB | Output is partially correct |
32 | Correct | 8 ms | 344 KB | Output is correct |
33 | Correct | 9 ms | 344 KB | Output is correct |
34 | Correct | 21 ms | 344 KB | Output is correct |
35 | Correct | 32 ms | 344 KB | Output is correct |
36 | Correct | 18 ms | 344 KB | Output is correct |
37 | Partially correct | 184 ms | 344 KB | Output is partially correct |
38 | Partially correct | 183 ms | 344 KB | Output is partially correct |
39 | Partially correct | 166 ms | 344 KB | Output is partially correct |
40 | Partially correct | 322 ms | 848 KB | Output is partially correct |
41 | Partially correct | 302 ms | 476 KB | Output is partially correct |
42 | Partially correct | 280 ms | 468 KB | Output is partially correct |
43 | Partially correct | 829 ms | 1104 KB | Output is partially correct |
44 | Partially correct | 869 ms | 1124 KB | Output is partially correct |
45 | Partially correct | 834 ms | 896 KB | Output is partially correct |
46 | Partially correct | 829 ms | 1008 KB | Output is partially correct |
47 | Partially correct | 842 ms | 1004 KB | Output is partially correct |
48 | Partially correct | 817 ms | 1228 KB | Output is partially correct |
49 | Partially correct | 856 ms | 1156 KB | Output is partially correct |
50 | Partially correct | 876 ms | 1108 KB | Output is partially correct |
51 | Partially correct | 846 ms | 1032 KB | Output is partially correct |
52 | Partially correct | 850 ms | 724 KB | Output is partially correct |
53 | Partially correct | 817 ms | 1040 KB | Output is partially correct |
54 | Partially correct | 809 ms | 808 KB | Output is partially correct |
55 | Partially correct | 836 ms | 1048 KB | Output is partially correct |
56 | Partially correct | 820 ms | 1152 KB | Output is partially correct |
57 | Partially correct | 827 ms | 1516 KB | Output is partially correct |
58 | Partially correct | 801 ms | 1028 KB | Output is partially correct |
59 | Partially correct | 817 ms | 1424 KB | Output is partially correct |
60 | Partially correct | 799 ms | 860 KB | Output is partially correct |
61 | Partially correct | 821 ms | 808 KB | Output is partially correct |
62 | Partially correct | 875 ms | 700 KB | Output is partially correct |
63 | Partially correct | 845 ms | 1088 KB | Output is partially correct |
64 | Partially correct | 859 ms | 1520 KB | Output is partially correct |
65 | Partially correct | 835 ms | 1340 KB | Output is partially correct |
66 | Partially correct | 827 ms | 1056 KB | Output is partially correct |
67 | Partially correct | 827 ms | 1036 KB | Output is partially correct |
68 | Partially correct | 806 ms | 1288 KB | Output is partially correct |
69 | Partially correct | 882 ms | 1164 KB | Output is partially correct |
70 | Partially correct | 878 ms | 728 KB | Output is partially correct |
71 | Partially correct | 853 ms | 1276 KB | Output is partially correct |
72 | Partially correct | 852 ms | 1204 KB | Output is partially correct |
73 | Partially correct | 842 ms | 1132 KB | Output is partially correct |
74 | Partially correct | 843 ms | 1212 KB | Output is partially correct |
75 | Partially correct | 822 ms | 556 KB | Output is partially correct |
76 | Partially correct | 861 ms | 852 KB | Output is partially correct |
77 | Partially correct | 825 ms | 1340 KB | Output is partially correct |
78 | Partially correct | 830 ms | 1156 KB | Output is partially correct |
79 | Partially correct | 805 ms | 1404 KB | Output is partially correct |
80 | Partially correct | 860 ms | 1000 KB | Output is partially correct |
81 | Partially correct | 841 ms | 816 KB | Output is partially correct |
82 | Partially correct | 724 ms | 1000 KB | Output is partially correct |