# Defribillators puzzle discussion

#207

Hmm, that’s weird, “Test 3 Complete file” was failing for me all the time. Even when I used the other formula mentioned here. It always calculated CRR as the closest one. But when I submited code even with the failing test I got 100 %. Not sure if there is a bug in my code (I am learning GO) or somewhere else:)

#208

Hi, I’ve just understood why you failed test 3 (I did too). Some defibrillators have the same location name, so if you keep that name in a variable, it will be erased by the next to come (I’m not sure this is really clear in English sorry).
You had to find “Caisse primaire d’assurance maladie” in that test 3, but there are 2 lines with that name : first was closest, but was erased by the second which is very far : so the next closest is finally CRR !

#209

Alright! Yeah that will be it probably. I used map where street name was a key, so if there would be a different device on the same street later on it would rewrite that one. Thanks a lot!

#210

Hi, same problem for me. All tests passed but when I submit I fail the “single possibility” one !
Must be something to investigate behind that ; what does “single possibility” mean ?

#211

Just reached 100 % using good old Pythagoras’ formula instead of that overcomplicated one provided by CG…

#212

thanks mate!

but why doesn’t the provided formular work for the complete list tests? it didn’t time out - I just got a unexpected result - like my program knows about the road conditions

#213

You did it wrong and got lucky. Hint: explorers in Antarctica don’t do it that way.

#214

Could anybody put here the correct calculations for the first record, please? I need the correct reference to compare.

I have:
1;Maison de la Prevention Sante;6 rue Maguelone 340000 Montpellier;;3,87952263361082;43,6071285339217
distance(km): 98.0960843753421

but something is wrong.
PS. The problem was the colon separator in initial user coordinates… Once again be aware of colons!

#215

Output from my code (values are rounded in the error output but not in the code)

Starting from (3.8795, 43.6082)
Distance to Maison de la Prevention Sante (3.8795, 43.6071) is 0.1166
Distance to Hotel de Ville (3.8965, 43.5987) is 1.7280
Distance to Zoo de Lunaret (3.8739, 43.6396) is 3.5217
Maison de la Prevention Sante

Hope that helps.

#216

#217

Strange i did all the 4 challenges correctly, but in the end only get 75% because the first one did not count. Can someone help me pls.

#218

same situation here, no idea what is the 1st validator…

#219

ok, je viens de resoudre ce même problème, peut etre t’as aussi défini par défault une distance minimum, essayer de donner une valeur plus grande comme 999999, hope it can help U ; )

#220

was the same problem for me, i declare a minimum distance 1000 as default and faild at 1st validator, i tried to change the min distance to 999999 and it worked.

#221

Not sure why, but I opened this puzzle again and now it sais it’s complete at 100% XD I did not change anything in it recently… And by the way, thanks for the tip but I was not using a big value for initialisation but -1 as a “uninitialized” mark so it’s not possible to encounter minimum distance problems with that method in theory ^^

EDIT: Turns out the problem for me was a C++ specific problem: while reading the input data you have to call an extra getline() before you start reading the defibrilators infos in a loop.

#222

I have the same issue in “Exact Position” and I cannot find any input with "Cimetiere …

I am using PHP.

Any help on this ?

#223

Thank you, I had this problem and was not understanding why Validator #1 was not working (on Python). Assigning a large value to this working variable solved my problem.

#225

Hi,

I’m stucked on 75% completion when submitting source (100% on test cases). The issue is we don’t have the detail of the purpose of the failure.

I firstly thought it was just a “precision issue”. So I check everything is declared as double, remove unnecessary computation involved in comparison to avoid floating point inaccurency (no sqare-root + no *6371). But it was not enough…

I thought there is time limits so I make sure the loop is performed once & minimize allocation & computation. Not enough

I thought “bad input format” should be managed in the final code, so I add exception management in case of ; Not enough

Any tip on what may miss?

The current code I have write.

class Solution
{

``````static double K_DEGREE_TO_RADIAN = 180.0d/Math.PI ;
``````
``````static void Main(string[] args)
{

<moderator note: don't post full code, please>
``````
``````    Console.WriteLine( bestSpotName ) ;
}
``````

}

Thank you

#226

Forgot one extra check on my post … I also investigate distance case equality (make a test with squaredDistance < bestScore & squaredDistance <= bestScore in case 2 solutions where possible)

#227

The latitudes and longitudes are given in radians… no need to convert them on your own. Remove that part and give it a try.