#include<bits/stdc++.h>
using namespace std;
#include "longesttrip.h"
// bool are_connected(vector<int>a,vector<int>b){
// return 0;
// }
vector<int> longest_trip(int n, int k)
{
vector<int>ans;
if(k == 3) for(int i = 0; i < n; i++) ans.push_back(i);
else if(k == 2){
int v = 0; ans.push_back(0);
vector<bool>vis(n,0);vis[0] = 1;
for(int i = 1; i < n; i++){
vector<int>wow;wow.push_back(v);
for(int j = 0; j < n; j++){
if(vis[j]) continue;
vector<int>wow2; wow2.push_back(j);
bool ok = are_connected(wow,wow2);
if(ok){
vis[j] = 1;
ans.push_back(j);
v = j;
break;
}
}
}
}
return ans;
}
// int main(){
// }
# |
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 |
Correct |
2 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
344 KB |
Output is correct |
2 |
Correct |
6 ms |
344 KB |
Output is correct |
3 |
Correct |
5 ms |
344 KB |
Output is correct |
4 |
Correct |
5 ms |
344 KB |
Output is correct |
5 |
Correct |
4 ms |
340 KB |
Output is correct |
6 |
Incorrect |
0 ms |
344 KB |
Incorrect |
7 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
- |