#include "longesttrip.h"
#include <bits/stdc++.h>
#define ll int
#define pb push_back
#define ins insert
#define fr first
#define sc second
#define vll vector<ll>
#define sz size()
#define pf push_front
#define bc back()
using namespace std;
const ll N = 260;
const ll inf = 1e9 + 7;
ll g[N][N];
bool vis[N];
vector<int> longest_trip(int n, int D){
ll i,j;
for(i=0;i<n;i++){
for(j=0;j<n;j++) g[i][j] = 0;
vis[i] = 0;
}
for(i=0;i<n;i++){
for(j=i+1;j<n;j++){
if(are_connected({i},{j})){
g[i][j] = g[j][i] = 1;
}
}
}
deque<ll> v;
v.pb(0);
for(i=0;i<n;i++){
if(g[0][i]){v.pb(i);break;}
}
for(i=0;i<n;i++){
if(vis[i])continue;
if(g[v[0]][i]) v.pf(i);
else if(g[v.bc][i]) v.pb(i);
}
vll ans;
for(auto i : v) ans.pb(i);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |