제출 #436105

#제출 시각아이디문제언어결과실행 시간메모리
436105HediChehaidar즐거운 행로 (APIO20_fun)C++17
컴파일 에러
0 ms0 KiB
/* ID: hedichehaidar TASK: photo LANG: C++11 */ #include<bits/stdc++.h> typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef double db; ll gcd(ll a , ll b) {return b ? gcd(b , a % b) : a ;} // greatest common divisor (PGCD) ll lcm(ll a , ll b) {return (a * b) / gcd(a , b);} // least common multiple (PPCM) #define ss second #define ff first #define all(x) (x).begin() , (x).end() #define pb push_back #define vi vector<int> #define vii vector<pair<int,int>> #define vl vector<ll> #define vll vector<pair<ll,ll>> #define pii pair<int,int> #define pll pair<ll,ll> #define pdd pair<double,double> #define vdd vector<pdd> #define dte tuple<double , double , double> using namespace std; const int INF = 1000*1000*1000; // 1 e 9 const int MOD = INF + 7; const double EPS = 0.000000001; // 1 e -9 const ll inf = (ll)1e18; bool vis[505]; int dist[505][505]; int n; vi createFunTour(int N , int Q){ n = N; for(int i = 0 ; i < n ; i++){ for(int j = i + 1 ; j < n ; j++){ dist[i][j] = dist[j][i] = hoursRequired(i , j); } } int mx = 1; for(int i = 2 ; i < n ; i++){ if(dist[0][i] > dist[0][mx]) mx = i; } int cur = 0; for(int i = 0 ; i < n ; i++){ if(dist[mx][i] > dist[mx][cur]) cur = i; } vis[cur] = true; vi res; res.pb(cur); int nb = 1; while(nb < n){ int mx = 0; for(int i = 0 ; i < n ; i++){ if(dist[cur][i] > dist[cur][mx] && !vis[i]) { mx = i; } vis[mx] = true; res.pb(mx); cur = mx; nb++; break; } } return res; } /*int main() { //ifstream fin ("race.in"); //ofstream fout ("race.out"); ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); return 0; }*/ /* Think of : BS / DFS / BFS / SSSP / SCC / MSP / MAX FLOW / TOPSORT / LCA / MATRIX / DP(bitmask) / 2 POINTERS / SEG TREE / MATH / UN FIND / MO Read the statement CAREFULLY !! Make a GREADY APPROACH !!!! (start from highest / lowest) Make your own TESTS !! Be careful from CORNER CASES ! */

컴파일 시 표준 에러 (stderr) 메시지

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