제출 #1072777

#제출 시각아이디문제언어결과실행 시간메모리
1072777kunzaZa183즐거운 행로 (APIO20_fun)C++17
26 / 100
254 ms524288 KiB
#include "fun.h" #include <bits/stdc++.h> using namespace std; vector<int> createFunTour(int N, int Q) { vector<vector<int>> dist(N,vector<int>(N)); for(int i = 0; i < N;i++) for(int j = i+1;j < N;j++) { dist[i][j] = hoursRequired(i,j); dist[j][i] = dist[i][j]; } // for(auto a:dist) // { // for(auto b:a) // cout<<b<<' '; // cout<<'\n'; // } vector<int> vi(N); iota(vi.begin(),vi.end(),0); int helper = 0; auto cmp = [&](int a, int b){ // cout<<helper<<' '<<a<<' '<<b<<"\n"; return dist[helper][a] < dist[helper][b]; }; int end1 = *max_element(vi.begin(),vi.end(),cmp); vector<int> ans(1,end1); vi.erase(find(vi.begin(),vi.end(),end1)); while(!vi.empty()) { helper = ans.back(); end1 = *max_element(vi.begin(), vi.end(), cmp); vi.erase(find(vi.begin(),vi.end(),end1)); ans.push_back(end1); } // for(auto a:ans) // cout<<a<<' '; // cout<<'\n'; return ans; }
#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...