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 <vector>
#define MAXN 505
int a[MAXN][MAXN];
bool isused[MAXN];
std::vector<int> createFunTour(int N, int Q) {
std::vector<int> V;
if (Q >= N * (N - 1) / 2) {
for (int i = 0 ; i < N ; i ++) {
isused[i] = 0;
for (int j = i + 1 ; j < N ; j ++) {
a[i][j] = a[j][i] = hoursRequired(i, j);
}
}
V.push_back(0);
for (int i = 1 ; i <= N ; i ++) {
int mj = -1;
for (int j = 0 ; j < N ; j ++) {
if (!isused[j]) {
if (mj == -1 || a[V[i - 1]][mj] < a[V[i - 1]][j]) mj = j;
}
}
V.push_back(mj);
isused[mj] = 1;
}
V.erase(V.begin());
}
return V;
}
# | 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... |