# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
941901 | benjaminkleyn | Longest Trip (IOI23_longesttrip) | C++17 | 12 ms | 860 KiB |
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 <bits/stdc++.h>
#include "longesttrip.h"
using namespace std;
vector<int> longest_trip(int N, int D)
{
if (D == 3)
{
vector<int> res(N);
iota(res.begin(), res.end(), 0);
return res;
}
if (D == 2)
{
vector<int> res;
int cur;
if (are_connected({0}, {1}))
res = {0, 1}, cur = 2;
else
res = {0, 2, 1}, cur = 3;
for (int i = cur; i < N; i++)
{
if (!are_connected({res.back()}, {i}))
reverse(res.begin(), res.end());
res.push_back(i);
}
return res;
Compilation message (stderr)
# | 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... |