# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
979954 | 2024-05-11T17:29:25 Z | vjudge1 | Longest Trip (IOI23_longesttrip) | C++17 | 0 ms | 0 KB |
#include "longesttrip.h" #include <bits/stdc++.h> using namespace std; vector<int> longest_trip(int N, int D){ vector<int> r(N); int j=0; r[0]=0; for(int i=1;i<N;i++){ int e1[1]={r[j]},e2[1]={i}; if(are_connected(e1,e2))j++,r[j]=i; else if(i==N-1){ for(int k=N-1;0<k;k--)r[k]=r[k-1]; r[0]=i; } else j++,r[j]=i+1,j++,r[j]=i,i++; } return r; }