# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
394159 |
2021-04-26T02:14:32 Z |
IloveN |
Fun Tour (APIO20_fun) |
C++14 |
|
1 ms |
208 KB |
#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 (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
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 |
1 |
Incorrect |
1 ms |
204 KB |
Repeated index |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Repeated index |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
1 ms |
208 KB |
Repeated index |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
1 ms |
208 KB |
Repeated index |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Repeated index |