Submission #436167

#TimeUsernameProblemLanguageResultExecution timeMemory
436167LouayFarahFun Tour (APIO20_fun)C++14
0 / 100
1 ms204 KiB
#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(dist[u][i]>maxi) { v = i; maxi = dist[u][i]; } } u = v; } 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...