Submission #395898

#TimeUsernameProblemLanguageResultExecution timeMemory
395898ErkhemkhuuFun Tour (APIO20_fun)C++17
0 / 100
1 ms460 KiB
#include <bits/stdc++.h> #include "fun.h" using namespace std; const int bigN = 505; int vis[bigN], dist[bigN][bigN]; vector <int> tour; vector <int> createFunTour(int N, int Q) { int n = N; for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) dist[i][j] = hoursRequired(i, j); } int curMax = 0; for(int i = 0; i < n; i++) { if(dist[0][i] > dist[0][curMax]) curMax = i; } vis[curMax] = true; tour.push_back(curMax); n--; while(n--) { int tempMax = 0; int maxCity = -1; for(int i = 0; i < n; i++) { if(vis[i]) continue; if(dist[curMax][i] > tempMax) { tempMax = dist[curMax][i]; maxCity = i; } } assert(maxCity != -1); vis[maxCity] = true; tour.push_back(maxCity); curMax = maxCity; } return tour; }
#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...