# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1070340 | zsombor | Longest Trip (IOI23_longesttrip) | C++17 | 7 ms | 436 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) {
bool b01=are_connected({0},{1});
bool b02=are_connected({0},{2});
vector <int> v;
if (!b01) v={0,2,1};
if (!b02) v={0,1,2};
if (b01 && b02) v={1,0,2};
deque<int> d;
for (int i : v) d.push_back(i);
for (int i=3;i<N;i++) {
int a=d.front(),b=d.back();
if (are_connected({a},{i})) d.push_front(i);
else d.push_back(i);
}
v.clear();
while (d.size()) {
v.push_back(d.front());
d.pop_front();
}
return v;
}
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... |