# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
413286 | ak2006 | Fun Tour (APIO20_fun) | C++14 | 267 ms | 524292 KiB |
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;
using vi = vector<int>;
using vvi = vector<vi>;
using vb = vector<bool>;
vi createFunTour(int n, int q) {
vi ret(n);
vb vis(n);
vvi dist(n,vi(n));
int cnt = 1;
int mx = 0;
int si = -1,sj = -1;
for (int i = 0;i<n;i++)
for (int j = i + 1;j<n;j++){
dist[i][j] = hoursRequired(i,j);
dist[j][i] = dist[i][j];
if (dist[i][j] > mx){
mx = dist[i][j];
si = i;
sj = j;
}
}
ret[0] = si;
vis[si] = 1;
while (cnt < n){
mx = 0;
int nsi = -1;
for (int j = 0;j<n;j++){
if (dist[si][j] > mx && !vis[j]){
mx = dist[si][j];
nsi = j;
}
}
ret[cnt++] = nsi;
si = nsi;
vis[si] = 1;
}
return ret;
}
Compilation message (stderr)
# | 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... |