제출 #751911

#제출 시각아이디문제언어결과실행 시간메모리
751911kenansalloum수천개의 섬 (IOI22_islands)C++17
컴파일 에러
0 ms0 KiB
#include <vector> #include <unordered_set> using namespace std; bool dfs(int curr, int prev, vector<vector<int>>& adjList, vector<int>& journey, unordered_set<int>& usedCanoes) { journey.push_back(curr); if (curr == 0 && journey.size() > 1) { return true; } for (int next : adjList[curr]) { if (next != prev && !usedCanoes.count(next)) { usedCanoes.insert(next); if (dfs(next, curr, adjList, journey, usedCanoes)) { return true; } usedCanoes.erase(next); } } journey.pop_back(); return false; } vector<int> find_journey(int N, int M, vector<int>& U, vector<int>& V) { vector<vector<int>> adjList(N); for (int i = 0; i < M; i++) { adjList[U[i]].push_back(i); adjList[V[i]].push_back(i); } vector<int> journey; unordered_set<int> usedCanoes; dfs(0, -1, adjList, journey, usedCanoes); if (journey.size() <= 2000000) { return journey; } else { return {}; } }

컴파일 시 표준 에러 (stderr) 메시지

/usr/bin/ld: /tmp/ccFHTPRQ.o: in function `main':
grader.cpp:(.text.startup+0x229): undefined reference to `find_journey(int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status