#include <bits/stdc++.h>
#include "longesttrip.h"
using namespace std;
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
ll inf = 1e18;
vector<int> s;
vector<int> used;
int n;
void dfs(int v) {
s.push_back(v);
used[v] = 1;
for (int i = 0; i < n; i++) {
if (used[i]) {
continue;
}
if (are_connected({v}, {i})) {
dfs(i);
break;
}
}
}
vector<int> longest_trip(int N, int d) {
n = N;
used.assign(n, 0);
dfs(0);
return s;
}
# | 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... |