Submission #858930

#TimeUsernameProblemLanguageResultExecution timeMemory
858930LudisseyLongest Trip (IOI23_longesttrip)C++17
5 / 100
3051 ms600 KiB
#include <bits/stdc++.h> #include "longesttrip.h" using namespace std; std::vector<int> longest_trip(int n, int d) { vector<int> A; vector<int> B; A.push_back(0); for (int i = 1; i < n; i++) { if(are_connected({i}, {A.back()})) A.push_back(i); else if(B.size()==0 || are_connected({i}, {B.back()})) B.push_back(i); else { for (int x = B.size()-1; x >= 0; x--) A.push_back(B[x]); B.clear(); } } if(A.size()<B.size()) swap(A,B); if(!are_connected({A[0]}, {A.back()})) while(true) { }; return A; }
#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...