제출 #576633

#제출 시각아이디문제언어결과실행 시간메모리
576633pooyashams즐거운 행로 (APIO20_fun)C++14
26 / 100
11 ms2644 KiB
#include "fun.h" #include <vector> using namespace std; typedef pair<int, int> pii; const int maxn = 510; int dist[maxn][maxn]; vector<int> G[maxn]; int hight[maxn]; bool vis[maxn]; vector<int> createFunTour(int N, int Q) { vector<int> ans; int mx = -1; int f = -1; for(int i = 0; i < N; i++) { for(int j = i+1; j < N; j++) { dist[i][j] = dist[j][i] = hoursRequired(i, j); if(mx < dist[i][j]) { mx = dist[i][j]; f = i; } if(dist[i][j] == 1) { //G[i].push_back(j); //G[j].push_back(i); } } } ans.push_back(f); vis[f] = true; for(int i = 1; i < N; i++) { pii mxdf = pii(-1, f); for(int j = 0; j < N; j++) { if(!vis[j]) mxdf = max(mxdf, pii(dist[f][j], j)); } f = mxdf.second; ans.push_back(f); vis[f] = true; } 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...