제출 #846201

#제출 시각아이디문제언어결과실행 시간메모리
846201JoksimKaktus가장 긴 여행 (IOI23_longesttrip)C++17
15 / 100
5 ms600 KiB
#include "longesttrip.h" #include <bits/stdc++.h> using namespace std; vector<int> longest_trip(int N, int D) { vector <int> v; if(D == 3){ for(int i = 0;i < N;i++){ v.push_back(i); } }else if(D == 2){ int last; if(are_connected({0},{1})){ v.push_back(0); v.push_back(1); if(are_connected({0},{2})){ v.insert(v.begin(),2); last = 1; }else{ v.push_back(2); last = 2; } }else{ v.push_back(0); v.push_back(2); v.push_back(1); last = 1; } for(int i = 3; i < N;i++){ if(are_connected({last},{i})){ v.push_back(i); last = i; }else{ v.insert(v.begin(),i); } } } return v; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...