답안 #994865

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
994865 2024-06-08T07:49:38 Z 김은성(#10865) 가장 긴 여행 (IOI23_longesttrip) C++17
30 / 100
900 ms 1728 KB
#include "longesttrip.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> graph[299];
bool ch[299];
vector<int> path;
void dfs(int v){
    ch[v] = 1;
    path.push_back(v);
    int i;
    for(i=0; i<graph[v].size(); i++){
        int u = graph[v][i];
        if(!ch[u]){
            dfs(u);
            return;
        }
    }
}

std::vector<int> longest_trip(int N, int D){
    int i, j;
    for(i=0; i<N; i++){
        graph[i].clear();
        ch[i] = 0;
    }
    for(i=0; i<N; i++){
        for(j=i+1; j<N; j++){
            if(are_connected({i}, {j})){
                graph[i].push_back(j);
                graph[j].push_back(i);
            }
        }
    }
    vector<int> ret;
    for(i=0; i<N; i++){
        path.clear();
        dfs(i);
        if(path.size() > ret.size())
            ret = path;
    }
    return ret;
}

Compilation message

longesttrip.cpp: In function 'void dfs(int)':
longesttrip.cpp:11:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for(i=0; i<graph[v].size(); i++){
      |              ~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 180 ms 1112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 344 KB Output is correct
2 Correct 29 ms 344 KB Output is correct
3 Correct 146 ms 344 KB Output is correct
4 Correct 437 ms 460 KB Output is correct
5 Correct 839 ms 1128 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 340 KB Output is correct
2 Correct 26 ms 344 KB Output is correct
3 Correct 159 ms 344 KB Output is correct
4 Correct 444 ms 344 KB Output is correct
5 Correct 777 ms 1260 KB Output is correct
6 Incorrect 1 ms 344 KB Incorrect
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 344 KB Output is correct
2 Correct 21 ms 344 KB Output is correct
3 Correct 129 ms 344 KB Output is correct
4 Correct 406 ms 468 KB Output is correct
5 Correct 803 ms 524 KB Output is correct
6 Correct 7 ms 344 KB Output is correct
7 Correct 22 ms 344 KB Output is correct
8 Correct 124 ms 344 KB Output is correct
9 Correct 320 ms 708 KB Output is correct
10 Correct 863 ms 876 KB Output is correct
11 Correct 848 ms 696 KB Output is correct
12 Correct 844 ms 1292 KB Output is correct
13 Correct 861 ms 1128 KB Output is correct
14 Correct 6 ms 344 KB Output is correct
15 Correct 11 ms 344 KB Output is correct
16 Correct 34 ms 344 KB Output is correct
17 Correct 95 ms 344 KB Output is correct
18 Correct 143 ms 344 KB Output is correct
19 Correct 299 ms 344 KB Output is correct
20 Correct 293 ms 592 KB Output is correct
21 Correct 841 ms 1060 KB Output is correct
22 Correct 845 ms 804 KB Output is correct
23 Correct 874 ms 924 KB Output is correct
24 Correct 834 ms 1292 KB Output is correct
25 Correct 10 ms 340 KB Output is correct
26 Correct 11 ms 344 KB Output is correct
27 Correct 28 ms 344 KB Output is correct
28 Correct 18 ms 344 KB Output is correct
29 Correct 31 ms 344 KB Output is correct
30 Correct 187 ms 344 KB Output is correct
31 Correct 227 ms 444 KB Output is correct
32 Correct 191 ms 600 KB Output is correct
33 Correct 300 ms 448 KB Output is correct
34 Correct 318 ms 464 KB Output is correct
35 Correct 350 ms 600 KB Output is correct
36 Correct 811 ms 948 KB Output is correct
37 Correct 817 ms 1232 KB Output is correct
38 Correct 829 ms 928 KB Output is correct
39 Correct 829 ms 1296 KB Output is correct
40 Correct 885 ms 1312 KB Output is correct
41 Correct 846 ms 468 KB Output is correct
42 Correct 862 ms 992 KB Output is correct
43 Correct 832 ms 1404 KB Output is correct
44 Correct 814 ms 1116 KB Output is correct
45 Correct 8 ms 344 KB Output is correct
46 Correct 12 ms 356 KB Output is correct
47 Correct 32 ms 344 KB Output is correct
48 Correct 21 ms 344 KB Output is correct
49 Correct 30 ms 344 KB Output is correct
50 Correct 215 ms 708 KB Output is correct
51 Correct 198 ms 600 KB Output is correct
52 Correct 165 ms 600 KB Output is correct
53 Correct 302 ms 472 KB Output is correct
54 Correct 292 ms 608 KB Output is correct
55 Correct 283 ms 440 KB Output is correct
56 Correct 854 ms 1104 KB Output is correct
57 Correct 895 ms 848 KB Output is correct
58 Correct 844 ms 1728 KB Output is correct
59 Correct 891 ms 1168 KB Output is correct
60 Correct 828 ms 1172 KB Output is correct
61 Correct 851 ms 448 KB Output is correct
62 Correct 821 ms 700 KB Output is correct
63 Correct 848 ms 1136 KB Output is correct
64 Correct 872 ms 1212 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 Partially correct 147 ms 344 KB Output is partially correct
4 Partially correct 405 ms 344 KB Output is partially correct
5 Partially correct 900 ms 732 KB Output is partially correct
6 Incorrect 0 ms 344 KB Incorrect
7 Halted 0 ms 0 KB -