#include "longesttrip.h"
#include <bits/stdc++.h>
using namespace std;
bool are_connected(vector<int> A, vector<int> B);
vector<int> longest_trip(int n, int d) {
deque<int> path;
if (are_connected({0}, {1})) {
if (are_connected({1}, {2})) {
path = {0, 1, 2};
} else {
path = {2, 0, 1};
}
} else {
path = {1, 2, 0};
}
for (int i = 3; i < n; i++) {
if (are_connected({i}, {path.back()})) {
path.push_back(i);
} else {
path.push_front(i);
}
}
return vector<int>(path.begin(), path.end());
}
# | 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... |