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)
{
deque<int> trip;
int iso = 2;
if(are_connected({0}, {1})){
trip.push_back(0);
trip.push_back(1);
}else{
trip.push_back(0);
trip.push_back(2);
iso = 1;
}
for(int i = 3; i < N; i++){
if(are_connected({trip.back()}, {i})) trip.push_back(i);
else trip.push_front(i);
}
if(are_connected({trip.back()}, {iso})) trip.push_back(iso);
else trip.push_front(iso);
return vector<int>(trip.begin(), trip.end());
}
# | 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... |