Submission #395897

#TimeUsernameProblemLanguageResultExecution timeMemory
395897ErkhemkhuuFun Tour (APIO20_fun)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; const int bigN = 505; int vis[bigN], dist[bigN][bigN]; vector <int> tour; vector <int> createFunTour(int N, int Q) { int n = N; for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) dist[i][j] = hoursRequired(i, j); } int curMax = 0; for(int i = 0; i < n; i++) { if(dist[0][i] > dist[0][curMax]) curMax = i; } vis[curMax] = true; tour.push_back(curMax); n--; while(n--) { int tempMax = 0; int maxCity = -1; for(int i = 0; i < n; i++) { if(vis[i]) continue; if(dist[curMax][i] > tempMax) { tempMax = dist[curMax][i]; maxCity = i; } } assert(maxCity != -1); vis[maxCity] = true; tour.push_back(maxCity); curMax = maxCity; } return tour; }

Compilation message (stderr)

fun.cpp: In function 'std::vector<int> createFunTour(int, int)':
fun.cpp:10:26: error: 'hoursRequired' was not declared in this scope
   10 |             dist[i][j] = hoursRequired(i, j);
      |                          ^~~~~~~~~~~~~