Submission #1081162

#TimeUsernameProblemLanguageResultExecution timeMemory
1081162MODDILongest Trip (IOI23_longesttrip)C++17
0 / 100
40 ms848 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...