This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "longesttrip.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define vi vector<int>
vector<int> G[257];
vector<int> best;
vector<bool> vis;
void dfs(int at, vector<int> path){
vis[at] = true;
path.pb(at);
if(best.size() < path.size()){
best = path;
}
for(auto next : G[at]){
if(!vis[next]){
dfs(next, path);
}
}
}
vector<int> longest_trip(int N, int D)
{
for(int i = 0; i < N; i++){
for(int j = i + 1; j < N; j++){
if(are_connected({i},{j})){
G[i].pb(j);
G[j].pb(i);
}
}
}
for(int i = 0; i < N; i++){
vis.assign(N, false);
dfs(i, {});
}
return best;
}
# | 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... |