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"
#include<bits/stdc++.h>
using namespace std;
void findLocation(int N, int first, int location[], int stype[])
{
stype[0]=1;
location[0]=first;
int mn = 1e9, idx=0;
for(int i =1;i<N;i++) {
int k = getDistance(0,i);
if(k < mn) {
mn=k;
idx=i;
}
}
stype[idx]=2;
location[idx]=first+mn;
for(int i = 1;i<N;i++) {
if(i==idx)continue;
int k1=getDistance(0,i), k2=getDistance(idx,i);
if(k1 < k2) {
stype[i]=2;
location[i]=first+k1;
}
else {
stype[i]=1;
location[i]=location[idx]-k2;
}
}
// for(int i = 1;i<N;i++) {
// cout << stype[i] << " " << location[i] << "\n";
// }
}
# | 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... |