#include "rail.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
//int getDistance(int i, int j);
void findLocation(int N, int first, int location[], int stype[]){
int n = N;
int minD = 2147483647;
int primerD;
for(int i= 1; i<n;i++){
int a = getDistance(0,i);
if(a <= minD){
minD = a;
primerD = i;
}
}
stype[0] = 1;
stype[primerD] = 2;
location[primerD] = first + getDistance(0,primerD);
location[0] = first;
for(int i=1;i<n;i++){
if(i!=primerD){
int a = getDistance(i, primerD);
if(a==-1){
//i = d tambien
stype[i] = 2;
location[i] = first + getDistance(0,i);
}else{
//i = c
stype[i] = 1;
location[i] = first - (a - getDistance(0,primerD));
}
}
}
/*
for(int i=0;i<n;i++){
if(i==0){
stype[i] = 1;
}else{
stype[i] = 2;
}
}
location[0] = first;
for(int i=1;i<n;i++){
int dis = getDistance(0,i);
location[i] = first + dis;
}
*/
}
# | 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... |