#include "longesttrip.h"
#include <bits/stdc++.h> 
#pragma GCC optimize("O3,unroll-loops") 
#pragma GCC target("avx2") 
#define pb push_back
#define F first
#define pii pair<int,int> 
#define all(a) a.begin(),a.end()
#define S second 
#define sz(a) (int)a.size()
#define rep(i , a , b) for(int i = (a) ; i <= (b) ; i++)
#define per(i , a , b) for(int i = (a) ; i >= (b) ; i--)
#define ld double
#define ll long long 
using namespace std ;
const int maxn = 5e5 + 10  ,s = 1000 , inf = 1e9 , mod = 998244353;
int ch(int v , int u){
    vector <int> a , b;
    a.pb(v);
    b.pb(u) ;
    return are_connected(a,b); 
}
std::vector<int> longest_trip(int n, int d){
    deque <int> vec ;
    int x01 = ch(0 , 1) , x12 = ch(1 , 2) , x20 = ch(2 ,0);
    if(x01 && x12){
        vec.pb(0) ;
        vec.pb(1);
        vec.pb(2);
    }else if(x12 && x20){
        vec.pb(1);
        vec.pb(2);
        vec.pb(0);
    }else{
        vec.pb(2);
        vec.pb(0);
        vec.pb(1); 
    }
    rep(i , 3 , n-1){
        if(ch(i , vec.back()))vec.pb(i);
        else vec.push_front(i) ;
    }
    vector <int> az ;
    rep(i , 0 , n-1){
        az.pb(vec[i]); 
    }
    return az;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |