제출 #436100

#제출 시각아이디문제언어결과실행 시간메모리
436100AmineTrabelsi즐거운 행로 (APIO20_fun)C++14
26 / 100
154 ms14776 KiB
#include "fun.h" #include <bits/stdc++.h> using namespace std; const int M = 505; vector<int> createFunTour(int N, int Q) { /* int H = hoursRequired(0, N - 1); int A = attractionsBehind(0, N - 1); */ int st = 0,mx = 0; for(int i=1;i<N;i++){ int q = hoursRequired(0,i); if(q > mx){ st = i; mx = q; } } vector<int> ans; ans.push_back(st); vector<bool> vis(N,0); vector<int> dist(N,0); int x = N-1; vis[st] = 1; while(x--){ for(int i=0;i<N;i++){ if(i != st){ dist[i] = hoursRequired(st,i); } } int ind = max_element(dist.begin(),dist.end())-dist.begin(); while(vis[ind]){ dist[ind] = 0; ind = max_element(dist.begin(),dist.end())-dist.begin(); } st = ind; vis[st] = 1; ans.push_back(ind); } 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...