답안 #995827

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
995827 2024-06-09T23:50:32 Z aaaaaarroz 가장 긴 여행 (IOI23_longesttrip) C++17
40 / 100
924 ms 1368 KB
#include <bits/stdc++.h>
using namespace std;
bool are_connected(vector<int>A,vector<int>B);
vector<vector<int>>graph;
vector<bool>v;
vector<int>path;
void dfs(int vecino){
    v[vecino]=true;
    path.push_back(vecino);
    for(int padre:graph[vecino]){
        if(!v[padre]){
            dfs(padre);
            return;
        }
    }
}
vector<int> longest_trip(int N, int D){
    graph.clear();
    v.clear();
    graph.resize(N,vector<int>());
    v.resize(N,false);
    for(int i=0; i<N; i++){
        for(int j=i+1; j<N; j++){
            if(are_connected({i}, {j})){
                graph[i].push_back(j);
                graph[j].push_back(i);
            }
        }
    }
    vector<int>ans;
    for(int i=0;i<N;i++){
        path.clear();
        for(int j=0;j<N;j++){
            v[j]=false;
        }
        dfs(i);
        if(path.size()>ans.size()){
            ans=path;
        }
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 189 ms 972 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 344 KB Output is correct
2 Correct 29 ms 344 KB Output is correct
3 Correct 148 ms 612 KB Output is correct
4 Correct 416 ms 712 KB Output is correct
5 Correct 836 ms 1116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 344 KB Output is correct
2 Correct 22 ms 344 KB Output is correct
3 Correct 148 ms 344 KB Output is correct
4 Correct 426 ms 600 KB Output is correct
5 Correct 874 ms 1132 KB Output is correct
6 Correct 6 ms 344 KB Output is correct
7 Correct 24 ms 344 KB Output is correct
8 Correct 148 ms 600 KB Output is correct
9 Correct 320 ms 672 KB Output is correct
10 Correct 859 ms 968 KB Output is correct
11 Correct 858 ms 848 KB Output is correct
12 Correct 924 ms 940 KB Output is correct
13 Correct 857 ms 1004 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 158 ms 600 KB Output is correct
4 Correct 412 ms 592 KB Output is correct
5 Correct 855 ms 1212 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 23 ms 344 KB Output is correct
8 Correct 138 ms 344 KB Output is correct
9 Correct 326 ms 736 KB Output is correct
10 Correct 909 ms 848 KB Output is correct
11 Correct 843 ms 720 KB Output is correct
12 Correct 920 ms 856 KB Output is correct
13 Correct 828 ms 1080 KB Output is correct
14 Correct 6 ms 344 KB Output is correct
15 Correct 8 ms 344 KB Output is correct
16 Correct 39 ms 396 KB Output is correct
17 Correct 101 ms 344 KB Output is correct
18 Correct 177 ms 600 KB Output is correct
19 Correct 305 ms 592 KB Output is correct
20 Correct 324 ms 592 KB Output is correct
21 Correct 847 ms 988 KB Output is correct
22 Correct 838 ms 1244 KB Output is correct
23 Correct 880 ms 968 KB Output is correct
24 Correct 871 ms 848 KB Output is correct
25 Correct 8 ms 344 KB Output is correct
26 Correct 13 ms 344 KB Output is correct
27 Correct 27 ms 344 KB Output is correct
28 Correct 28 ms 344 KB Output is correct
29 Correct 29 ms 344 KB Output is correct
30 Correct 216 ms 600 KB Output is correct
31 Correct 214 ms 456 KB Output is correct
32 Correct 205 ms 344 KB Output is correct
33 Correct 310 ms 476 KB Output is correct
34 Correct 312 ms 724 KB Output is correct
35 Correct 356 ms 444 KB Output is correct
36 Correct 886 ms 784 KB Output is correct
37 Correct 861 ms 1368 KB Output is correct
38 Correct 890 ms 1000 KB Output is correct
39 Correct 880 ms 1004 KB Output is correct
40 Correct 807 ms 848 KB Output is correct
41 Correct 853 ms 844 KB Output is correct
42 Correct 823 ms 684 KB Output is correct
43 Correct 869 ms 692 KB Output is correct
44 Correct 871 ms 848 KB Output is correct
45 Correct 8 ms 344 KB Output is correct
46 Correct 11 ms 344 KB Output is correct
47 Correct 27 ms 340 KB Output is correct
48 Correct 33 ms 344 KB Output is correct
49 Correct 20 ms 344 KB Output is correct
50 Correct 190 ms 600 KB Output is correct
51 Correct 218 ms 600 KB Output is correct
52 Correct 214 ms 344 KB Output is correct
53 Correct 305 ms 716 KB Output is correct
54 Correct 290 ms 728 KB Output is correct
55 Correct 298 ms 468 KB Output is correct
56 Correct 849 ms 872 KB Output is correct
57 Correct 868 ms 876 KB Output is correct
58 Correct 895 ms 1224 KB Output is correct
59 Correct 795 ms 932 KB Output is correct
60 Correct 878 ms 984 KB Output is correct
61 Correct 883 ms 1108 KB Output is correct
62 Correct 886 ms 888 KB Output is correct
63 Correct 884 ms 964 KB Output is correct
64 Correct 902 ms 848 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 344 KB Output is correct
2 Correct 20 ms 344 KB Output is correct
3 Partially correct 154 ms 344 KB Output is partially correct
4 Partially correct 451 ms 592 KB Output is partially correct
5 Partially correct 883 ms 1044 KB Output is partially correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 25 ms 344 KB Output is correct
8 Partially correct 161 ms 592 KB Output is partially correct
9 Partially correct 335 ms 472 KB Output is partially correct
10 Partially correct 842 ms 1164 KB Output is partially correct
11 Partially correct 848 ms 1088 KB Output is partially correct
12 Partially correct 876 ms 780 KB Output is partially correct
13 Partially correct 892 ms 1360 KB Output is partially correct
14 Correct 7 ms 344 KB Output is correct
15 Correct 10 ms 344 KB Output is correct
16 Incorrect 6 ms 344 KB Incorrect
17 Halted 0 ms 0 KB -