Submission #1063029

#TimeUsernameProblemLanguageResultExecution timeMemory
1063029uacoder123Rail (IOI14_rail)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define F first #define FOR(i,a,b) for (auto i = (a); i <= (b); ++i) #define NFOR(i,a,b) for(auto i = (a); i >= (b); --i) #define all(x) (x).begin(), (x).end() #define sz(x) lli(x.size()) #define mp(i,a) make_pair(i,a) #define pb(a) push_back(a) #define bit(x,b) (x&(1LL<<b)) typedef long long int lli; typedef pair <lli,lli> ii; typedef pair <ii,lli> iii; typedef pair <ii,ii> iiii; typedef vector <lli> vi; typedef tree<lli,null_type,less<lli>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; void findLocation(int n, int first, int location[], int stype[]) { int dis[n],mi=-1,in=1; location[0]=first; stype[0]=1; for(int i=1;i<n;++i) { dis[i]=getDistance(0,i); if(i==1) { mi=dis[i]; in=i; } else if(dis[i]<mi) { mi=dis[i]; in=i; } } location[in]=first+mi; stype[in]=2; for(int i=1;i<n;++i) { if(i==in) continue; int d=getDistance(in,i),d1; if(dis[in]+d==dis[i]) { d1=getDistance(i,in); if(d1==d) { location[i]=mi-d1; stype[i]=2; } else { location[i]=mi-d1; stype[i]=1; } } else { d1=getDistance(i,0); if(d1==dis[i]) { location[i]=first+d1; stype[i]=1; } else { location[i]=first+d1; stype[i]=2; } } } }

Compilation message (stderr)

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:27:12: error: 'getDistance' was not declared in this scope
   27 |     dis[i]=getDistance(0,i);
      |            ^~~~~~~~~~~
rail.cpp:45:11: error: 'getDistance' was not declared in this scope
   45 |     int d=getDistance(in,i),d1;
      |           ^~~~~~~~~~~
rail.cpp:48:7: error: 'd1' was not declared in this scope; did you mean 'd'?
   48 |       d1=getDistance(i,in);
      |       ^~
      |       d
rail.cpp:62:7: error: 'd1' was not declared in this scope; did you mean 'd'?
   62 |       d1=getDistance(i,0);
      |       ^~
      |       d