Submission #14724

#TimeUsernameProblemLanguageResultExecution timeMemory
14724gs13068Rail (IOI14_rail)C++98
Compilation error
0 ms0 KiB
//#include "rail.h" #include <algorithm> int getDistance(int,int); std::pair<int,int> a[5555]; void findLocation(int n,int fir,int loc[],int stp[]) { int i,j,k,l,r,ld,rd; loc[0]=fir; stp[0]=1; if(n==1)return; a[0].first=0; a[0].second=0; for(i=1;i<n;i++) { a[i].first=getDistance(0,i); a[i].second=i; } std::sort(a+1,a+n); loc[a[1].second]=loc[0]+a[1].first; stp[a[1].second]=2; l=0;r=a[1].second; for(i=2;i<n;i++) { ld=getDistance(l,a[i].second); rd=getDistance(r,a[i].second); for(j=0;j<i;j++)if(stp[a[j].second]==1&&loc[a[j].second]<loc[l]+ld&&loc[r]-loc[a[j].second]+loc[l]+ld-loc[a[j].second]==rd)break; if(j<i) { loc[a[i].second]=loc[l]+ld; stp[a[i].second]=2; } else { loc[a[i].second]=loc[r]-rd; stp[a[i].second]=1; } } }

Compilation message (stderr)

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:10:10: warning: unused variable 'k' [-Wunused-variable]
  int i,j,k,l,r,ld,rd;
          ^
/tmp/ccXE7y8p.o: In function `main':
grader.cpp:(.text.startup+0x299): undefined reference to `findLocation'
/tmp/ccQzEtHa.o: In function `findLocation(int, int, int*, int*)':
rail.cpp:(.text+0x28d): undefined reference to `getDistance(int, int)'
rail.cpp:(.text+0x36e): undefined reference to `getDistance(int, int)'
rail.cpp:(.text+0x381): undefined reference to `getDistance(int, int)'
collect2: error: ld returned 1 exit status