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;
const int M = 505;
vector<int> createFunTour(int N, int Q) {
/*
int H = hoursRequired(0, N - 1);
int A = attractionsBehind(0, N - 1);
*/
int st = 0,mx = 0;
for(int i=1;i<N;i++){
int q = hoursRequired(0,i);
if(q > mx){
st = i;
mx = q;
}
}
vector<int> ans;
ans.push_back(st);
vector<bool> vis(N,0);
vector<int> dist(N,0);
int x = N-1;
vis[st] = 1;
while(x--){
for(int i=0;i<N;i++){
if(i != st){
dist[i] = hoursRequired(st,i);
}
}
int ind = max_element(dist.begin(),dist.end())-dist.begin();
while(vis[ind]){
dist[ind] = 0;
ind = max_element(dist.begin(),dist.end())-dist.begin();
}
st = ind;
vis[st] = 1;
ans.push_back(ind);
}
return ans;
}
# | 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... |