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;
using ll = long long;
int n;
int dis[505][505], sz[505][505];
bool ch[505];
vector<int> createFunTour(int _N, int Q) {
n = _N;
for (int i = 0;i < n;i++) {
for (int j = i + 1;j < n;j++) {
dis[i][j] = dis[j][i] = hoursRequired(i, j);
}
}
for (int i = 0;i < n;i++) {
for (int j = 0;j < n;j++) {
if (i == j) continue;
sz[i][j] = attractionsBehind(i, j);
}
}
int mx = 0, idx = 0;
for (int i = 0;i < n;i++) {
if (dis[0][i] > mx) {
mx = dis[0][i];
idx = i;
}
}
vector<int> res;
res.push_back(idx);
ch[idx] = 1;
for (int i = 1;i < n;i++) {
int mx = 0, idx = 0;
for (int j = 0;j < n;j++) {
if (ch[j]) continue;
if (dis[res.back()][j] > mx) {
mx = dis[res.back()][j];
idx = j;
}
}
ch[idx] = 1;
res.push_back(idx);
}
return res;
}
# | 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... |