Submission #1310326

#TimeUsernameProblemLanguageResultExecution timeMemory
1310326AliMark71가장 긴 여행 (IOI23_longesttrip)C++20
0 / 100
1 ms332 KiB
#include "longesttrip.h" #include <bits/stdc++.h> template<typename T> using vec = std::vector<T>; using namespace std; std::vector<int> longest_trip(int N, int D) { vec<int> nodes(N); for (int i = 1; i <= N; i++) nodes[i - 1] = i; if (D == 3) return nodes; if (D == 2) { deque<int> path{1, are_connected({1}, {2}) ? 2 : 3}; nodes.erase(find(nodes.begin(), nodes.end(), path.front())); nodes.erase(find(nodes.begin(), nodes.end(), path.back())); while (!nodes.empty()) { auto u = nodes.back(); nodes.pop_back(); if (are_connected({path.front()}, {u})) path.push_front(u); else path.push_back(u); } return vec<int>(path.begin(), path.end()); } return {}; // womp womp }
#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...