Submission #858543

#TimeUsernameProblemLanguageResultExecution timeMemory
858543ikura355Longest Trip (IOI23_longesttrip)C++17
5 / 100
5 ms344 KiB
#include "longesttrip.h" #include <bits/stdc++.h> using namespace std; std::vector<int> longest_trip(int n, int density) { if (density == 3) { // Return list of 0 to N-1 vector<int> ans(n); iota(ans.begin(), ans.end(), 0); return ans; } else if (density == 2) { vector<int> nxt(n); int head = 0, tail = 0; for (int i = 1; i < n; i++) { if (are_connected({head}, {i})) { nxt[i] = head; head = i; } else { nxt[tail] = i; tail = i; } } vector<int> ans; while (true) { ans.push_back(head); if (head == tail) break; head = nxt[head]; } return ans; } return {}; }
#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...