# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
846512 | 2023-09-07T17:02:32 Z | Trisanu_Das | Longest Trip (IOI23_longesttrip) | C++17 | 0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; #include "longesttrip.h" 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 + 1); ans.push_back(u + 2); u += 2; }else{ reverse(ans.begin(), ans.end()); ans.push_back(n - 1); u++; } } return ans; }