# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
841787 | flashmt | Longest Trip (IOI23_longesttrip) | C++17 | 10 ms | 684 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 "longesttrip.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> longest_trip(int n, int d)
{
vector<int> c[2];
c[0] = {0};
int checkedLast = 0;
for (int i = 1; i < n; i++)
{
int x = c[0].back();
if (are_connected({i}, {x}))
{
c[0].push_back(i);
checkedLast = 0;
}
else if (empty(c[1]) || checkedLast)
{
c[1].push_back(i);
checkedLast = 1;
}
else
{
int y = c[1].back();
if (are_connected({i}, {y}))
{
c[1].push_back(i);
checkedLast = 1;
}
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... |