제출 #878559

#제출 시각아이디문제언어결과실행 시간메모리
878559thinknoexit가장 긴 여행 (IOI23_longesttrip)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "longesttrip.h" using namespace std; using ll = long long; int n, d; bool adj[256][256]; vector<int> longest_trip(int N, int D) { n = N; d = D; memset(adj, 0, sizeof adj); for (int i = 0;i < n;i++) { for (int j = i + 1;j < n;j++) { adj[i][j] = adj[j][i] = are_connected({ i }, { j }); } } queue<int> q; for (int i = 1;i < n;i++) { q.push(i); } deque<int> ans; ans.push_back(0); while (!q.empty()) { if (adj[ans.back()][q.front()]) { ans.push_back(q.front()); q.pop(); } else { ans.push_front(q.front()); q.pop(); } } return ans; }

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

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:32:12: error: could not convert 'ans' from 'std::deque<int, std::allocator<int> >' to 'std::vector<int>'
   32 |     return ans;
      |            ^~~
      |            |
      |            std::deque<int, std::allocator<int> >