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> a(1, 0);
vector<int> b(1, 1);
for (int i = 2; i < N; i++) {
if (are_connected({a.back()}, {b.back()})) {
while (b.size()) {
a.push_back(b.back());
b.pop_back();
}
b.push_back(i);
continue;
}
if (are_connected({a.back()}, {i})) a.push_back(i);
else b.push_back(i);
}
return (a.size() > b.size() ? a : b);
}
# | 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... |