제출 #855156

#제출 시각아이디문제언어결과실행 시간메모리
855156evenvalue가장 긴 여행 (IOI23_longesttrip)C++17
0 / 100
1 ms344 KiB
#include "longesttrip.h" #include <bits/stdc++.h> using namespace std; template<typename T> using min_heap = priority_queue<T, vector<T>, greater<T>>; template<typename T> using max_heap = priority_queue<T, vector<T>, less<T>>; using int64 = long long; using ld = long double; constexpr int kInf = 1e9 + 10; constexpr int64 kInf64 = 1e15 + 10; constexpr int kMod = 1e9 + 7; std::vector<int> longest_trip(int N, int D) { deque<int> longest_path; for (int i = 0; i < 3; i++) { const int j = (i + 1) % 3; if (not are_connected({i}, {j})) { longest_path = {i, (i + 2) % 3, j}; } } for (int x = 3; x < N; x++) { const int y = longest_path.back(); if (are_connected({x}, {y})) { longest_path.push_back(x); } else { longest_path.push_front(x); } } vector<int> ans; for (const int x : longest_path) { ans.push_back(x); } 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...