제출 #546081

#제출 시각아이디문제언어결과실행 시간메모리
546081amunduzbaev즐거운 행로 (APIO20_fun)C++17
0 / 100
1 ms212 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=1;i<=n;i++){ for(int j=i+1;j<=n;j++){ d[i][j] = d[j][i] = hoursRequired(i, j); } } vector<int> used(n + 1); auto get = [&](int a){ int b = a; for(int i=1;i<=n;i++){ if(used[i]) continue; if(d[i][a] > d[b][a]) b = i; } return b; }; int a = 1, b = 1; 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...