제출 #575336

#제출 시각아이디문제언어결과실행 시간메모리
575336Theo830철로 (IOI14_rail)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = 1e9; ll MOD = 998244353; typedef pair<ll,ll> ii; #define iii pair<ii,ll> #define f(i,a,b) for(ll i = a;i < b;i++) #define pb push_back #define vll vector<ll> #define F first #define S second #define all(x) (x).begin(), (x).end() ///I hope I will get uprating and don't make mistakes ///I will never stop programming ///sqrt(-1) Love C++ ///Please don't hack me ///@TheofanisOrfanou Theo830 ///Think different approaches (bs,dp,greedy,graphs,shortest paths,mst) ///Stay Calm ///Look for special cases ///Beware of overflow and array bounds ///Think the problem backwards ///Training void findLocation(int n, int first, int location[], int stype[]){ location[0] = first; stype[0] = 1; ll dist[n] = {0}; ll dist2[n] = {0}; vector<ii>arr; f(i,1,n){ dist[i] = getDistance(0,i); arr.pb(ii(dist[i],i)); } sort(all(arr)); ll D = arr[0].S; location[D] = first + arr[0].F; stype[D] = 2; f(i,0,n){ if(i != D){ dist2[i] = getDistance(D,i); } } vector<ii>left,right; f(i,1,n){ if(i != D){ assert(dist[i] != dist2[i]); if(dist[i] < dist2[i]){ right.pb(ii(dist[i],i)); } else{ left.pb(ii(dist2[i],i)); } } } sort(all(left)); sort(all(right)); ll last = D; for(auto x:right){ ll A = x.F - dist[last]; if(getDistance(last,x.S) < A){ location[x.S] = location[last] - A; stype[x.S] = 1; } else{ location[x.S] = location[last] + A; stype[x.S] = 2; last = x.S; } } last = 0; for(auto x:left){ ll A = x.F - dist2[last]; if(getDistance(last,x.S) < A){ location[x.S] = location[last] + A; stype[x.S] = 2; } else{ location[x.S] = location[last] - A; stype[x.S] = 1; last = x.S; } } }

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

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:32:19: error: 'getDistance' was not declared in this scope
   32 |         dist[i] = getDistance(0,i);
      |                   ^~~~~~~~~~~
rail.cpp:41:24: error: 'getDistance' was not declared in this scope
   41 |             dist2[i] = getDistance(D,i);
      |                        ^~~~~~~~~~~
rail.cpp:61:12: error: 'getDistance' was not declared in this scope
   61 |         if(getDistance(last,x.S) < A){
      |            ^~~~~~~~~~~
rail.cpp:74:12: error: 'getDistance' was not declared in this scope
   74 |         if(getDistance(last,x.S) < A){
      |            ^~~~~~~~~~~