제출 #1059712

#제출 시각아이디문제언어결과실행 시간메모리
1059712mychecksedad가장 긴 여행 (IOI23_longesttrip)C++17
15 / 100
7 ms432 KiB
#include "longesttrip.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define all(x) x.begin(),x.end() #define ll long long #define ff first #define ss second #define vi vector<int> const int N = 200005; std::vector<int> longest_trip(int n, int D) { if(D == 3){ vector<int> v; for(int i = 0; i < n; ++i) v.pb(i); return v; } if(D == 2){ deque<int> v; v.pb(0); int o = -1; for(int i = 1; i < n; ++i){ bool x = are_connected(vi{0}, vi{i}); if(x){ o = i; v.pb(i); break; } } if(o == -1){ vi res; for(int i = 1; i < n; ++i){ res.pb(i); } return res; } for(int i = 1; i < n; ++i){ if(o == i) continue; bool x = are_connected(vi{v[0]}, vi{i}); if(x){ v.push_front(i); }else v.pb(i); } vector<int> res(all(v)); return res; } return {}; }
#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...