Submission #725783

#TimeUsernameProblemLanguageResultExecution timeMemory
725783LittleFlowers__Fun Tour (APIO20_fun)C++17
0 / 100
2065 ms300 KiB
#include "fun.h" #include <bits/stdc++.h> using namespace std; vector<int> createFunTour(int n, int q) { vector<vector<int>> distance(n, vector<int>(n)); for (int i = 0; i < n; ++i) for (int j = i + 1; j < n; ++j) { distance[i][j] = distance[j][i] = hoursRequired(i, j); } vector<int> perm(n); iota(perm.begin(), perm.end(), 0); do { bool failed = false; for (int i = 2; i < n; ++i) { if (distance[perm[i]][perm[i - 1]] > distance[perm[i - 1]][perm[i - 2]]) { failed = true; break; } } if (!failed) return perm; } while (next_permutation(perm.begin(), perm.end())); assert(false); return vector<int>(n); }
#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...