Submission #902111

#TimeUsernameProblemLanguageResultExecution timeMemory
902111UmairAhmadMirzaRail (IOI14_rail)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int const N=5005; int dist1[N]; int dist2[N]; bool done[N]; int getDistance(int i, int j); void findLocation(int n, int firloc, int location[], int stype[]){ int fir=0; location[0]=firloc; stype[0]=1; done[fir]=1; if(n==1) return; set<pair<int,int>> dd; for (int i = 1; i < n; ++i){ dist1[i]=getDistance(0,i); dd.insert({dist1[i],i}); } // cout<<endl; auto p=*(dd.begin()); int sec=p.second; for (int i = 1; i < n; ++i) { if(i==sec) continue; dist2[i]=getDistance(sec,i); if(dist2[i]<dist1[i] && dist2[i]>dist1[sec]) dd.erase({dist1[i],i}); } while(dd.size()){ auto p=*(dd.begin()); dd.erase(p); int seco=p.second; location[seco]=p.first+location[0]; stype[seco]=2; done[seco]=1; // cout<<"mini"<<endl; // cout<<location[0]<<endl; // cout<<seco<<' '<<p.first<<endl; for (int i = 1; i < n; ++i) { if(done[i]) continue; if(dist2[i]<dist1[i] && dist2[i]-dist1[seco]>0) continue; int dis=getDistance(seco,i); if(dist1[i]-dist1[seco]==dis){ done[i]=1; location[i]=location[seco]-dis; stype[i]=1; dd.erase({dist1[i],i}); } } } for (int i = 1; i < n; ++i) if(done[i]==0) dd.insert({dist2[i],i}); while(dd.size()){ auto p=*(dd.begin()); dd.erase(p); int firo=p.second; location[firo]=location[sec]-p.first; stype[firo]=1; done[firo]=1; for (int i = 1; i < n; ++i) { if(done[i]) continue; int dis=getDistance(firo,i); if(dist2[i]-dist2[firo]==dis){ done[i]=1; location[i]=location[firo]+dis; stype[i]=2; dd.erase({dist2[i],i}); } } } // for (int i = 0; i < n; ++i) // cout<<location[i]<<' '<<stype[i]<<endl; }

Compilation message (stderr)

/usr/bin/ld: /tmp/cckdut7j.o: in function `findLocation(int, int, int*, int*)':
rail.cpp:(.text+0x30d): undefined reference to `getDistance(int, int)'
/usr/bin/ld: rail.cpp:(.text+0x370): undefined reference to `getDistance(int, int)'
/usr/bin/ld: rail.cpp:(.text+0x449): undefined reference to `getDistance(int, int)'
/usr/bin/ld: rail.cpp:(.text+0x56c): undefined reference to `getDistance(int, int)'
/usr/bin/ld: /tmp/ccWcZLVi.o: in function `main':
grader.cpp:(.text.startup+0x2d9): undefined reference to `findLocation'
collect2: error: ld returned 1 exit status