제출 #1105002

#제출 시각아이디문제언어결과실행 시간메모리
1105002Gr1sen가장 긴 여행 (IOI23_longesttrip)C++17
5 / 100
11 ms504 KiB
#include "longesttrip.h" #include <iostream> #include <vector> #include <algorithm> using namespace std; #define ll long long #define vi vector<int> #define concatenate(v1,v2) v1.insert(v1.end(), v2.begin(), v2.end()); vector<int> longest_trip(int N, int D) { //cerr << "oink" << endl; vi path1 = {0}, path2; int i = 1; while (i < N) { //cerr << i << endl; if (are_connected({i}, {path1.back()})) { path1.push_back(i); if (!path2.empty() && are_connected({i}, {path2.back()})) { concatenate(path1, path2); path2.clear(); } i++; continue; } path2.push_back(i); if (path1.size() < path2.size()) swap(path1, path2); i++; } return path1; }
#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...