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;
#define pb push_back
vector<int> createFunTour(int n, int q)
{
vector<vector<int>> dist(n, vector<int>(n, 0));
for(int i = 0; i<n; i++)
{
for(int j = 0; j<n; j++)
{
dist[i][j] = hoursRequired(i, j);
}
}
int u = 0;
int ma = 0;
for(int i = 0; i<n; i++)
{
for(int j = 0; j<n; j++)
{
if(dist[i][j]>ma)
{
ma = dist[i][j];
u = i;
}
}
}
vector<bool> visited(n, false);
vector<int> res;
while((int)res.size()<n)
{
res.pb(u);
visited[u] = true;
int maxi = 0;
int v = 0;
for(int i = 0; i<n; i++)
{
if(visited[i])
continue;
if(dist[u][i]>maxi)
{
v = i;
maxi = dist[u][i];
}
}
u = v;
}
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... |