Submission #395899

#TimeUsernameProblemLanguageResultExecution timeMemory
395899ErkhemkhuuFun Tour (APIO20_fun)C++17
26 / 100
35 ms1356 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...