This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "longesttrip.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> longest_trip(int N, int D)
{
vector <int> v;
if(D == 3){
for(int i = 0;i < N;i++){
v.push_back(i);
}
}else if(D == 2){
int last;
if(are_connected({0},{1})){
v.push_back(0);
v.push_back(1);
if(are_connected({0},{2})){
v.insert(v.begin(),2);
last = 1;
}else{
v.push_back(2);
last = 2;
}
}else{
v.push_back(0);
v.push_back(2);
v.push_back(1);
last = 1;
}
for(int i = 3; i < N;i++){
if(are_connected({last},{i})){
v.push_back(i);
last = i;
}else{
v.insert(v.begin(),i);
}
}
}
return v;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |