Submission #1218942

#TimeUsernameProblemLanguageResultExecution timeMemory
1218942im2xtreme가장 긴 여행 (IOI23_longesttrip)C++17
Compilation error
0 ms0 KiB
#include <vector> using namespace std; vector<bool> visited; vector<int> current_path, best_path; void dfs(int u, const vector<vector<int>>& adj) { visited[u] = true; current_path.push_back(u); if (current_path.size() > best_path.size()) { best_path = current_path; } for (int v : adj[u]) { if (!visited[v]) { dfs(v, adj); } } visited[u] = false; current_path.pop_back(); } int* longest_trip(int N, int D) { vector<vector<int>> adj(N); for (int current = 0; current < N; current++) { for (int i = N - 1; i > current; i--) { if (are_connected({current}, {i})) { adj[current].push_back(i); adj[i].push_back(current); } } } visited = vector<bool>(N, false); best_path.clear(); for (int i = 0; i < N; i++) { current_path.clear(); dfs(i, adj); } int* result = new int[best_path.size()]; for (int i = 0; i < (int)best_path.size(); ++i) { result[i] = best_path[i]; } return result; }

Compilation message (stderr)

longesttrip.cpp: In function 'int* longest_trip(int, int)':
longesttrip.cpp:30:17: error: 'are_connected' was not declared in this scope
   30 |             if (are_connected({current}, {i})) {
      |                 ^~~~~~~~~~~~~