# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
850145 | Rifal | Longest Trip (IOI23_longesttrip) | C++17 | 6 ms | 600 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"
using namespace std;
#include<bits/stdc++.h>
std::vector<int> longest_trip(int N, int D)
{
vector<int> ans;
if(D == 3) {
for(int i = 0; i < N; i++) {
ans.push_back(i);
}
}
else if(D == 2) {
set<int> st;
deque<int> dq;
for(int i = 1; i < N; i++) st.insert(i);
dq.push_back(0);
if(are_connected({dq.back()}, {1}) == true) {
dq.push_back(1); st.erase(1);
}
else {
dq.push_back(2); st.erase(2);
}
for(auto i : st) {
if(are_connected({dq.back()}, {i}) == true) {
dq.push_back(i);
}
else {
dq.push_front(i);
}
}
for(int i = 0; i < dq.size(); i++) {
ans.push_back(dq[i]);
}
}
else {
}
return ans;
}
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... |