#include<bits/stdc++.h>
#include "rail.h"
using namespace std;
const int INF = 1e9;
template<class T>bool minimize(T& a, T b){
if(a > b){
a = b;
return true;
}
return false;
}
void findLocation(int n, int first, int location[], int stype[]){
location[0] = first;
vector<int>f0(n);
int best = INF, near;
for(int i = stype[0] = 1; i < n; i++){
if(minimize(best, f0[i] = getDistance(0, i))){
near = i;
}
}
stype[near] = 2;
for(int i = 1; i < n; i++){
if(i != near){
stype[i] = 1 + int(getDistance(i, near) > f0[i]);
}
}
for(int i = 1; i < n; i++){
location[i] = (stype[i] == 1 ? first - f0[i] + (best << 1) : first + f0[i]);
}
}
# | 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... |