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 <bits/stdc++.h>
#include "rail.h"
using namespace std;
const int maxN=5010;
struct node{int dis,num;}a[maxN];
bool cmp(node x,node y){return x.dis<y.dis;}
void findLocation(int N, int first, int location[], int stype[]){
stype[0]=1;
location[0]=first;
for (int i=1;i<N;i++){a[i].dis=getDistance(0,i);a[i].num=i;}
sort(a+1,a+N,cmp);
int X1=a[1].num;
location[X1]=first+a[1].dis;
stype[X1]=2;
int lft=a[1].dis*2;
for (int i=2;i<N;i++){
int X=a[i].num;
int D=getDistance(X1,X);
if (D>a[i].dis){
location[X]=first+a[i].dis;
stype[X]=2;
}else{
location[X]=first-a[i].dis+lft;
stype[X]=1;
}
}
}
# | 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... |