#include "longesttrip.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> longest_trip(int N, int D)
{
set <int> num;
deque <int> curr;
vector <int> ans;
for(int i=0;i<N;i++) num.insert(i);
num.erase(0);
curr.push_back(0);
if(are_connected({0},{1})==1){
num.erase(1);
curr.push_back(1);
}
else{
num.erase(2);
curr.push_back(2);
}
for(int i:num){
if(are_connected({curr.back()},{i})==1) curr.push_back(i);
else curr.push_front(i);
}
for(int i:curr) ans.push_back(i);
return ans;
}
# | 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... |