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;
typedef pair<int,int> pii;
vector<int> createFunTour(int N, int Q) {
if(N <= 500){
vector<vector<int> > t(N, vector<int>(N));
pii start = {-1, 0};
for(int i = 0; i < N; i++)
for(int j = 0; j < N; j++) t[i][j] = hoursRequired(i,j), start = max(start, {t[i][j], i});
vector<bool> alive(N, true);
int poz = start.second;
vector<int> ans(N, 0);
for(int x = 0; x < N; x++){
ans[x] = poz;
alive[poz] = false;
pii best = {-1, 0};
for(int i = 0; i < N; i++)
if(alive[i]) best = max(best, {t[poz][i], i});
poz = best.second;
}
return ans;
}
}
Compilation message (stderr)
fun.cpp: In function 'std::vector<int> createFunTour(int, int)':
fun.cpp:25:1: warning: control reaches end of non-void function [-Wreturn-type]
25 | }
| ^
# | 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... |