Submission #1062799

#TimeUsernameProblemLanguageResultExecution timeMemory
1062799oscar1fRail (IOI14_rail)C++17
30 / 100
39 ms2648 KiB
#include "rail.h" const int TAILLE_MAX=5000+5,INFINI=1000*1000*1000; int nbBloc; int dist[TAILLE_MAX][TAILLE_MAX]; void findLocation(int N, int first, int location[], int stype[]) { nbBloc=N; location[0]=first; stype[0]=1; if (N==1) { return ; } int mini=INFINI,posMin=0; for (int i=1;i<nbBloc;i++) { dist[0][i]=getDistance(0,i); if (dist[0][i]<mini) { mini=dist[0][i]; posMin=i; } } location[posMin]=mini+first; stype[posMin]=2; for (int i=1;i<nbBloc;i++) { if (i!=posMin) { dist[posMin][i]=getDistance(posMin,i); if (dist[0][i]==mini+dist[posMin][i]) { location[i]=mini+first-dist[posMin][i]; stype[i]=1; } else { location[i]=first+dist[0][i]; stype[i]=2; } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...