Submission #546082

#TimeUsernameProblemLanguageResultExecution timeMemory
546082amunduzbaevFun Tour (APIO20_fun)C++17
26 / 100
48 ms27792 KiB
#include "fun.h" #include "bits/stdc++.h" using namespace std; #ifndef EVAL #include "grader.cpp" #endif const int B = 894; int d[B][B]; vector<int> createFunTour(int n, int Q) { if(n <= B){ for(int i=0;i<n;i++){ for(int j=i+1;j<n;j++){ d[i][j] = d[j][i] = hoursRequired(i, j); } } vector<int> used(n); auto get = [&](int a){ int b = a; for(int i=0;i<n;i++){ if(used[i]) continue; if(d[i][a] > d[b][a]) b = i; } return b; }; int a = 0, b = 0; b = get(a); vector<int> p; p.push_back(b); used[b] = 1; while((int)p.size() < n){ a = get(b); p.push_back(a); used[a] = 1; b = a; } return p; } assert(false); }
#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...