This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |