This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |