제출 #436169

#제출 시각아이디문제언어결과실행 시간메모리
436169LouayFarah즐거운 행로 (APIO20_fun)C++14
26 / 100
388 ms524292 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(visited[i]) continue; 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...