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 <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 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... |