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;
#define ll long long
#define FORi(i,a,n) for(int i=a;i<n;i++)
#define FOR(i,n) FORi(i,0,n)
#define F first
#define S second
void findLocation(int n, int first, int location[], int stype[]) {
location[0] = first;
stype[0] = 1;
int mind = 100000000;
int mindpos=-1;
FORi(j,1,n){
int c = getDistance(0,j);
//cout<<j<<" "<<c<<endl;
if(c<mind) mind = c, mindpos = j;
}
assert(mindpos!=-1);
location[mindpos] = first + mind;
stype[mindpos] = 2;
//cout<<mind<<endl;
//cout<<mindpos<<" "<<location[mindpos]<<endl;
FORi(i,1,n){
if(i==mindpos) continue;
int ac = getDistance(0,i);
//cout<<ac<<endl;
if(ac==mind+getDistance(mindpos, i)) location[i] = first - ac + 2*mind;
else location[i] = first + ac;
if(location[i]<first)
stype[i] = 1;
else stype[i] = 2;
//cout<<i<<" "<<location[i]<<endl;
}
}
# | 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... |