Submission #1069721

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10697212024-08-22 08:30:58UmairAhmadMirzaLongest Trip (IOI23_longesttrip)C++17
40 / 100
991 ms600 KiB
#include <bits/stdc++.h>
using namespace std;
bool are_connected(vector<int> A, vector<int> B);
int const MAXN=260;
bool con[MAXN][MAXN];
vector<int> path,longest;
bool vis[MAXN];
int nn;
void dfs(int node){
path.push_back(node);
if(path.size()>longest.size())
longest=path;
vis[node]=1;
for(int i=0;i<nn;i++)
if(vis[i]==0 && con[node][i])
dfs(i);
path.pop_back();
}
vector<int> longest_trip(int n, int D){
longest.clear();
nn=n;
vector<int> a,b;
for(int i=0;i<n;i++){
a.push_back(i);
for(int j=i+1;j<n;j++){
b.push_back(j);
con[i][j]=con[j][i]=are_connected(a,b);
b.pop_back();
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:38:8: warning: unused variable 'bl' [-Wunused-variable]
   38 |   bool bl=0;
      |        ^~
#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...