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;
#ifndef EVAL
#include "grader.cpp"
#endif
const int B = 894;
int d[B][B];
vector<int> createFunTour(int n, int Q) {
if(n <= B){
for(int i=1;i<=n;i++){
for(int j=i+1;j<=n;j++){
d[i][j] = d[j][i] = hoursRequired(i, j);
}
}
vector<int> used(n + 1);
auto get = [&](int a){
int b = a;
for(int i=1;i<=n;i++){
if(used[i]) continue;
if(d[i][a] > d[b][a]) b = i;
} return b;
};
int a = 1, b = 1;
b = get(a);
vector<int> p; p.push_back(b);
used[b] = 1;
while((int)p.size() < n){
a = get(b);
p.push_back(a);
used[a] = 1;
b = a;
} return p;
} assert(false);
}
# | 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... |