답안 #1007009

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1007009 2024-06-24T10:53:39 Z 3as8 가장 긴 여행 (IOI23_longesttrip) C++17
컴파일 오류
0 ms 0 KB
#include "longesttrip.h"

#include<bits/stdc++.h>

#define ll long long
using namespace std;

bool con[300][300];
bool vis[300];

ll n;
void dfs(ll startIndex, vector<ll>& curr) {


    vis[startIndex] = true;
    curr.push_back(startIndex);

    for(int i = 0; i < n; i++) {
        if(con[startIndex][i] && !vis[i]) {
            dfs(startIndex, curr);
        }
    }

}


std::vector<int> longest_trip(int N, int D) {

    n = N;
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++) {
            con[i][j] = are_connected({i}, {j});
        }
    }

    vector<ll> ans;
    ll mx = LLONG_MIN;
    for(int j = 0; j < n; j++) vis[j] = false;
    vector<ll> curr;
    dfs(i);

    return curr;
}

Compilation message

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:40:9: error: 'i' was not declared in this scope
   40 |     dfs(i);
      |         ^
longesttrip.cpp:42:12: error: could not convert 'curr' from 'vector<long long int>' to 'vector<int>'
   42 |     return curr;
      |            ^~~~
      |            |
      |            vector<long long int>
longesttrip.cpp:37:8: warning: unused variable 'mx' [-Wunused-variable]
   37 |     ll mx = LLONG_MIN;
      |        ^~