Submission #1028916

#TimeUsernameProblemLanguageResultExecution timeMemory
1028916Mr_Husanboy가장 긴 여행 (IOI23_longesttrip)C++17
15 / 100
8 ms600 KiB
#include "longesttrip.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define ff first #define ss second #define all(a) (a).begin(), (a).end() template<typename T> int len(T &a){return a.size();} int ask(int a, int b){ return are_connected({a}, {b}); } vector<int> longest_trip(int n, int d) { deque<int> cur = {0}; vector<int> done(n, 0); done[0] = 1; for(int i = 1; i < n; i ++){ if(ask(cur[0], i)){ cur.push_back(i); done[i] = 1; break; } } for(int i = 0; i < n; i ++){ if(done[i]) continue; if(ask(cur[0], i)){ cur.push_front(i); }else cur.push_back(i); } vector<int> res; for(auto u : cur) res.push_back(u); return res; }
#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...