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 ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(vr) vr.begin(),vr.end()
#define vi vector<int>
#define vll vector<ll>
const int N = 5e2 + 10;
int d[N][N], vis[N];
vi createFunTour(int n, int Q) {
//int H = hoursRequired(0, N - 1);
//int A = attractionsBehind(0, N - 1);
for (int i = 0; i < n; ++i)
for (int j = i + 1; j < n; ++j) d[i][j] = d[j][i] = hoursRequired(i, j);
int cur = 0;
for (int i = 1; i < n; ++i)
if (d[0][i] > d[0][cur]) cur = i;
for (int i = 0; i < n; ++i) vis[i] = 0;
vi ans;
ans.eb(cur);
vis[cur] = 1;
for (int i = 1; i < n; ++i)
{
int nxt, mx = -1;
for (int j = 0; j < n; ++j)
if (!vis[j] && d[cur][j] > mx) nxt = j, mx = d[cur][j];
cur = nxt;
ans.eb(cur);
vis[cur] = 1;
}
return ans;
}
/*int main()
{
//freopen("ss.inp", "r", stdin);
ios::sync_with_stdio(false);
cin.tie(0);
return 0;
}*/
Compilation message (stderr)
fun.cpp: In function 'std::vector<int> createFunTour(int, int)':
fun.cpp:34:13: warning: 'nxt' may be used uninitialized in this function [-Wmaybe-uninitialized]
34 | int nxt, mx = -1;
| ^~~
# | 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... |