Submission #751911

#TimeUsernameProblemLanguageResultExecution timeMemory
751911kenansalloumThousands Islands (IOI22_islands)C++17
Compilation error
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 {}; } }

Compilation message (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