#include "rail.h"
#include<bits/stdc++.h>
using namespace std;
void findLocation(int N, int first, int location[], int stype[]){
location[0] = first;
stype[0] = 1;
if (N == 1) return;
vector<int> d1(N, 0), d2(N, 0);
int csf = pow(10, 7), cs;
for (int i=1; i<N; i++){
d1[i] = getDistance(0, i);
if (d1[i] < csf){
csf = d1[i];
cs = i;
}
}
location[cs] = first+d1[cs];
stype[cs] = 2;
for (int i=1; i<N; i++){
if (i == cs) continue;
d2[i] = getDistance(cs, i);
if (d2[i] > d1[i]){
location[i] = first+d1[i];
stype[i] = 2;
}
else {
location[i] = first+d1[cs]-d2[i];
stype[i] = 1;
}
}
return;
}
# | 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... |