# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
853590 | 2023-09-24T17:13:21 Z | Andrey | 가장 긴 여행 (IOI23_longesttrip) | C++17 | 862 ms | 1368 KB |
#include "longesttrip.h" #include<bits/stdc++.h> using namespace std; bool haha[1000][1000]; vector<int> longest_trip(int n, int d) { for(int i = 0; i < n; i++) { haha[i][i] = false; for(int j = i+1; j < n; j++) { bool c = are_connected({i},{j}); haha[i][j] = c; haha[j][i] = c; } } vector<bool> bruh(n,true); deque<int> ans; ans.push_back(0); bruh[0] = false; for(int i = 1; i < n; i++) { if(haha[0][i]) { ans.push_back(i); bruh[i] = false; break; } } if(ans.size() > 1) { for(int i = 2; i < n; i++) { int p; for(int j = 0; j < n; j++) { if(bruh[j]) { p = j; } } int a = ans[0],b = ans[ans.size()-1]; if(haha[a][p]) { ans.push_front(p); bruh[p] = false; } else if(haha[b][p]) { ans.push_back(p); bruh[p] = false; } else { int c = -1,d; for(int j = 0; j < n; j++) { for(int y = 0; y < n; y++) { if(bruh[j] == false && bruh[y] == true && haha[j][y]) { c = y; d = j; } } } if(c == -1) { break; } while(ans[0] != d) { ans.push_back(ans[0]); ans.pop_front(); } ans.push_front(c); bruh[c] = false; } } } vector<int> wut(0); for(int i = 0; i < ans.size(); i++) { wut.push_back(ans[i]); } if(ans.size() == n) { return wut; } else { if(ans.size() < n-ans.size()) { wut.clear(); for(int i = 0; i < n; i++) { if(bruh[i]) { wut.push_back(i); } } } } return wut; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 152 ms | 664 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 344 KB | Output is correct |
2 | Correct | 26 ms | 344 KB | Output is correct |
3 | Correct | 122 ms | 344 KB | Output is correct |
4 | Correct | 359 ms | 656 KB | Output is correct |
5 | Correct | 783 ms | 672 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 344 KB | Output is correct |
2 | Correct | 25 ms | 344 KB | Output is correct |
3 | Correct | 112 ms | 344 KB | Output is correct |
4 | Correct | 365 ms | 544 KB | Output is correct |
5 | Correct | 718 ms | 668 KB | Output is correct |
6 | Correct | 8 ms | 344 KB | Output is correct |
7 | Correct | 22 ms | 344 KB | Output is correct |
8 | Correct | 126 ms | 344 KB | Output is correct |
9 | Correct | 293 ms | 512 KB | Output is correct |
10 | Correct | 713 ms | 856 KB | Output is correct |
11 | Correct | 742 ms | 672 KB | Output is correct |
12 | Correct | 711 ms | 668 KB | Output is correct |
13 | Correct | 725 ms | 856 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 344 KB | Output is correct |
2 | Correct | 25 ms | 344 KB | Output is correct |
3 | Correct | 141 ms | 344 KB | Output is correct |
4 | Correct | 369 ms | 772 KB | Output is correct |
5 | Correct | 722 ms | 664 KB | Output is correct |
6 | Correct | 7 ms | 344 KB | Output is correct |
7 | Correct | 23 ms | 344 KB | Output is correct |
8 | Correct | 137 ms | 344 KB | Output is correct |
9 | Correct | 267 ms | 520 KB | Output is correct |
10 | Correct | 786 ms | 668 KB | Output is correct |
11 | Correct | 759 ms | 668 KB | Output is correct |
12 | Correct | 739 ms | 856 KB | Output is correct |
13 | Correct | 720 ms | 668 KB | Output is correct |
14 | Correct | 8 ms | 344 KB | Output is correct |
15 | Correct | 10 ms | 344 KB | Output is correct |
16 | Correct | 59 ms | 344 KB | Output is correct |
17 | Correct | 72 ms | 344 KB | Output is correct |
18 | Correct | 127 ms | 344 KB | Output is correct |
19 | Correct | 296 ms | 592 KB | Output is correct |
20 | Correct | 295 ms | 592 KB | Output is correct |
21 | Correct | 750 ms | 668 KB | Output is correct |
22 | Correct | 694 ms | 668 KB | Output is correct |
23 | Correct | 719 ms | 720 KB | Output is correct |
24 | Correct | 721 ms | 668 KB | Output is correct |
25 | Correct | 8 ms | 344 KB | Output is correct |
26 | Correct | 8 ms | 344 KB | Output is correct |
27 | Correct | 22 ms | 344 KB | Output is correct |
28 | Correct | 24 ms | 344 KB | Output is correct |
29 | Correct | 27 ms | 344 KB | Output is correct |
30 | Correct | 151 ms | 444 KB | Output is correct |
31 | Correct | 170 ms | 444 KB | Output is correct |
32 | Correct | 170 ms | 440 KB | Output is correct |
33 | Correct | 264 ms | 516 KB | Output is correct |
34 | Correct | 268 ms | 592 KB | Output is correct |
35 | Correct | 289 ms | 512 KB | Output is correct |
36 | Correct | 741 ms | 664 KB | Output is correct |
37 | Correct | 756 ms | 668 KB | Output is correct |
38 | Correct | 769 ms | 672 KB | Output is correct |
39 | Correct | 809 ms | 668 KB | Output is correct |
40 | Correct | 752 ms | 668 KB | Output is correct |
41 | Correct | 713 ms | 672 KB | Output is correct |
42 | Correct | 773 ms | 856 KB | Output is correct |
43 | Correct | 788 ms | 664 KB | Output is correct |
44 | Correct | 755 ms | 668 KB | Output is correct |
45 | Correct | 8 ms | 344 KB | Output is correct |
46 | Correct | 8 ms | 344 KB | Output is correct |
47 | Correct | 23 ms | 344 KB | Output is correct |
48 | Correct | 24 ms | 344 KB | Output is correct |
49 | Correct | 25 ms | 512 KB | Output is correct |
50 | Correct | 159 ms | 440 KB | Output is correct |
51 | Correct | 173 ms | 440 KB | Output is correct |
52 | Correct | 165 ms | 448 KB | Output is correct |
53 | Correct | 290 ms | 516 KB | Output is correct |
54 | Correct | 268 ms | 600 KB | Output is correct |
55 | Correct | 263 ms | 592 KB | Output is correct |
56 | Correct | 765 ms | 668 KB | Output is correct |
57 | Correct | 761 ms | 664 KB | Output is correct |
58 | Correct | 757 ms | 856 KB | Output is correct |
59 | Correct | 717 ms | 668 KB | Output is correct |
60 | Correct | 730 ms | 668 KB | Output is correct |
61 | Correct | 715 ms | 664 KB | Output is correct |
62 | Correct | 715 ms | 664 KB | Output is correct |
63 | Correct | 700 ms | 668 KB | Output is correct |
64 | Correct | 720 ms | 664 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 344 KB | Output is correct |
2 | Correct | 21 ms | 344 KB | Output is correct |
3 | Partially correct | 100 ms | 344 KB | Output is partially correct |
4 | Partially correct | 336 ms | 600 KB | Output is partially correct |
5 | Partially correct | 702 ms | 668 KB | Output is partially correct |
6 | Correct | 7 ms | 344 KB | Output is correct |
7 | Correct | 18 ms | 344 KB | Output is correct |
8 | Partially correct | 112 ms | 344 KB | Output is partially correct |
9 | Partially correct | 249 ms | 512 KB | Output is partially correct |
10 | Partially correct | 706 ms | 668 KB | Output is partially correct |
11 | Partially correct | 676 ms | 848 KB | Output is partially correct |
12 | Partially correct | 708 ms | 856 KB | Output is partially correct |
13 | Partially correct | 678 ms | 856 KB | Output is partially correct |
14 | Correct | 7 ms | 344 KB | Output is correct |
15 | Correct | 10 ms | 344 KB | Output is correct |
16 | Correct | 39 ms | 344 KB | Output is correct |
17 | Partially correct | 83 ms | 344 KB | Output is partially correct |
18 | Partially correct | 122 ms | 344 KB | Output is partially correct |
19 | Partially correct | 244 ms | 344 KB | Output is partially correct |
20 | Partially correct | 233 ms | 516 KB | Output is partially correct |
21 | Correct | 8 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 | 22 ms | 344 KB | Output is correct |
25 | Correct | 21 ms | 344 KB | Output is correct |
26 | Partially correct | 150 ms | 440 KB | Output is partially correct |
27 | Partially correct | 157 ms | 444 KB | Output is partially correct |
28 | Partially correct | 159 ms | 440 KB | Output is partially correct |
29 | Partially correct | 261 ms | 592 KB | Output is partially correct |
30 | Partially correct | 277 ms | 592 KB | Output is partially correct |
31 | Partially correct | 257 ms | 592 KB | Output is partially correct |
32 | Correct | 7 ms | 344 KB | Output is correct |
33 | Correct | 10 ms | 344 KB | Output is correct |
34 | Correct | 21 ms | 344 KB | Output is correct |
35 | Correct | 23 ms | 600 KB | Output is correct |
36 | Correct | 23 ms | 344 KB | Output is correct |
37 | Partially correct | 147 ms | 444 KB | Output is partially correct |
38 | Partially correct | 182 ms | 444 KB | Output is partially correct |
39 | Partially correct | 156 ms | 704 KB | Output is partially correct |
40 | Partially correct | 245 ms | 536 KB | Output is partially correct |
41 | Partially correct | 263 ms | 532 KB | Output is partially correct |
42 | Partially correct | 244 ms | 592 KB | Output is partially correct |
43 | Partially correct | 687 ms | 668 KB | Output is partially correct |
44 | Partially correct | 704 ms | 668 KB | Output is partially correct |
45 | Partially correct | 704 ms | 1368 KB | Output is partially correct |
46 | Partially correct | 703 ms | 668 KB | Output is partially correct |
47 | Partially correct | 728 ms | 668 KB | Output is partially correct |
48 | Partially correct | 727 ms | 664 KB | Output is partially correct |
49 | Partially correct | 767 ms | 664 KB | Output is partially correct |
50 | Partially correct | 703 ms | 672 KB | Output is partially correct |
51 | Partially correct | 705 ms | 832 KB | Output is partially correct |
52 | Partially correct | 754 ms | 672 KB | Output is partially correct |
53 | Partially correct | 736 ms | 856 KB | Output is partially correct |
54 | Partially correct | 782 ms | 1112 KB | Output is partially correct |
55 | Partially correct | 746 ms | 600 KB | Output is partially correct |
56 | Partially correct | 769 ms | 668 KB | Output is partially correct |
57 | Partially correct | 770 ms | 840 KB | Output is partially correct |
58 | Partially correct | 763 ms | 668 KB | Output is partially correct |
59 | Partially correct | 788 ms | 668 KB | Output is partially correct |
60 | Partially correct | 813 ms | 848 KB | Output is partially correct |
61 | Partially correct | 830 ms | 668 KB | Output is partially correct |
62 | Partially correct | 781 ms | 668 KB | Output is partially correct |
63 | Partially correct | 771 ms | 664 KB | Output is partially correct |
64 | Partially correct | 739 ms | 668 KB | Output is partially correct |
65 | Partially correct | 771 ms | 856 KB | Output is partially correct |
66 | Partially correct | 825 ms | 668 KB | Output is partially correct |
67 | Partially correct | 755 ms | 664 KB | Output is partially correct |
68 | Partially correct | 734 ms | 848 KB | Output is partially correct |
69 | Partially correct | 748 ms | 668 KB | Output is partially correct |
70 | Partially correct | 755 ms | 856 KB | Output is partially correct |
71 | Partially correct | 795 ms | 748 KB | Output is partially correct |
72 | Partially correct | 796 ms | 668 KB | Output is partially correct |
73 | Partially correct | 746 ms | 668 KB | Output is partially correct |
74 | Partially correct | 777 ms | 668 KB | Output is partially correct |
75 | Partially correct | 807 ms | 668 KB | Output is partially correct |
76 | Partially correct | 785 ms | 664 KB | Output is partially correct |
77 | Partially correct | 818 ms | 664 KB | Output is partially correct |
78 | Partially correct | 816 ms | 668 KB | Output is partially correct |
79 | Partially correct | 862 ms | 664 KB | Output is partially correct |
80 | Partially correct | 777 ms | 856 KB | Output is partially correct |
81 | Partially correct | 760 ms | 668 KB | Output is partially correct |
82 | Partially correct | 775 ms | 800 KB | Output is partially correct |