제출 #878560

#제출 시각아이디문제언어결과실행 시간메모리
878560thinknoexit가장 긴 여행 (IOI23_longesttrip)C++17
5 / 100
764 ms592 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(); } } vector<int> Ans; while (!ans.empty()) Ans.push_back(ans.front()), ans.pop_front(); return Ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...