Submission #927559

#TimeUsernameProblemLanguageResultExecution timeMemory
927559aykhnLongest Trip (IOI23_longesttrip)C++17
15 / 100
6 ms600 KiB
#include <bits/stdc++.h> #include "longesttrip.h" using namespace std; vector<int> longest_trip(int n, int d) { vector<int> used(n, 0); deque<int> dq; used[0] = 1; dq.push_back(0); if (are_connected({0}, {1})) dq.push_back(1), used[1] = 1; else dq.push_back(2), used[2] = 1; for (int i = 0; i < n; i++) { if (used[i]) continue; if (are_connected({dq.back()}, {i})) dq.push_back(i); else dq.push_front(i); used[i] = 1; } vector<int> res; while (!dq.empty()) res.push_back(dq.front()), dq.pop_front(); return res; }
#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...