Submission #1072696

#TimeUsernameProblemLanguageResultExecution timeMemory
1072696thinknoexitFun Tour (APIO20_fun)C++17
26 / 100
16 ms2412 KiB
#include "fun.h" #include<bits/stdc++.h> using namespace std; using ll = long long; int n; int dis[505][505], sz[505][505]; bool ch[505]; vector<int> createFunTour(int _N, int Q) { n = _N; for (int i = 0;i < n;i++) { for (int j = i + 1;j < n;j++) { dis[i][j] = dis[j][i] = hoursRequired(i, j); } } for (int i = 0;i < n;i++) { for (int j = 0;j < n;j++) { if (i == j) continue; sz[i][j] = attractionsBehind(i, j); } } int mx = 0, idx = 0; for (int i = 0;i < n;i++) { if (dis[0][i] > mx) { mx = dis[0][i]; idx = i; } } vector<int> res; res.push_back(idx); ch[idx] = 1; for (int i = 1;i < n;i++) { int mx = 0, idx = 0; for (int j = 0;j < n;j++) { if (ch[j]) continue; if (dis[res.back()][j] > mx) { mx = dis[res.back()][j]; idx = j; } } ch[idx] = 1; res.push_back(idx); } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...