#include "longesttrip.h"
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
bool vis[500];
vector<int>v[500];
vector<int>ans;
void dfs(int a){
vis[a]=1;
ans.pb(a);
for(auto b:v[a]){
if(vis[b]==0){
dfs(b);
}
}
}
std::vector<int> longest_trip(int N, int D)
{
ans.clear();
for(int i=0;i<N;i++){
vis[i]=0;
v[i].clear();
}
for(int i=0;i<N;i++){
for(int j=i+1;j<N;j++){
if(are_connected({i},{j})){
v[i].pb(j);
v[j].pb(i);
}
}
}
dfs(0);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
146 ms |
1012 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
344 KB |
Output is correct |
2 |
Correct |
14 ms |
344 KB |
Output is correct |
3 |
Correct |
126 ms |
468 KB |
Output is correct |
4 |
Correct |
327 ms |
600 KB |
Output is correct |
5 |
Correct |
664 ms |
1132 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
344 KB |
Output is correct |
2 |
Correct |
19 ms |
344 KB |
Output is correct |
3 |
Correct |
126 ms |
344 KB |
Output is correct |
4 |
Correct |
356 ms |
344 KB |
Output is correct |
5 |
Correct |
688 ms |
756 KB |
Output is correct |
6 |
Incorrect |
1 ms |
344 KB |
Incorrect |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
344 KB |
Output is correct |
2 |
Correct |
19 ms |
344 KB |
Output is correct |
3 |
Correct |
120 ms |
600 KB |
Output is correct |
4 |
Correct |
338 ms |
592 KB |
Output is correct |
5 |
Correct |
704 ms |
1144 KB |
Output is correct |
6 |
Incorrect |
0 ms |
344 KB |
Incorrect |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
344 KB |
Output is correct |
2 |
Correct |
18 ms |
344 KB |
Output is correct |
3 |
Partially correct |
130 ms |
344 KB |
Output is partially correct |
4 |
Partially correct |
372 ms |
600 KB |
Output is partially correct |
5 |
Partially correct |
683 ms |
1092 KB |
Output is partially correct |
6 |
Incorrect |
1 ms |
344 KB |
Incorrect |
7 |
Halted |
0 ms |
0 KB |
- |