제출 #395897

#제출 시각아이디문제언어결과실행 시간메모리
395897Erkhemkhuu즐거운 행로 (APIO20_fun)C++17
컴파일 에러
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; }

컴파일 시 표준 에러 (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);
      |                          ^~~~~~~~~~~~~