Submission #429985

#TimeUsernameProblemLanguageResultExecution timeMemory
429985SundavarFun Tour (APIO20_fun)C++14
26 / 100
332 ms524292 KiB
#include "fun.h" #include <bits/stdc++.h> using namespace std; typedef pair<int,int> pii; vector<int> createFunTour(int N, int Q) { if(N <= 500){ vector<vector<int> > t(N, vector<int>(N)); pii start = {-1, 0}; for(int i = 0; i < N; i++) for(int j = 0; j < N; j++) t[i][j] = hoursRequired(i,j), start = max(start, {t[i][j], i}); vector<bool> alive(N, true); int poz = start.second; vector<int> ans(N, 0); for(int x = 0; x < N; x++){ ans[x] = poz; alive[poz] = false; pii best = {-1, 0}; for(int i = 0; i < N; i++) if(alive[i]) best = max(best, {t[poz][i], i}); poz = best.second; } return ans; } }

Compilation message (stderr)

fun.cpp: In function 'std::vector<int> createFunTour(int, int)':
fun.cpp:25:1: warning: control reaches end of non-void function [-Wreturn-type]
   25 | }
      | ^
#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...