Submission #846520

#TimeUsernameProblemLanguageResultExecution timeMemory
846520Trisanu_DasLongest Trip (IOI23_longesttrip)C++17
15 / 100
7 ms600 KiB
#include "longesttrip.h" #include <bits/stdc++.h> using namespace std; vector<int> longest_trip(int N, int D) { vector<int> ans; int u = 0; ans.push_back(u); while(u < N - 1) { if(are_connected({u}, {u + 1})) ans.push_back(++u); else if(u != N - 2) { ans.push_back(u + 2); ans.push_back(u + 1); u += 2; } else { reverse(ans.begin(), ans.end()); ans.push_back(N - 1); u++; } } 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...