6 kyu

Simple Fun #222: Gold Mine Race

62 of 76myjinxin2015
Description
Loading description...
Algorithms
Fundamentals
  • Please sign in or sign up to leave a comment.
  • mrbaker1917 Avatar

    For this test, goldMineRace([[1,6], [1,-4], [-4,1], [11,1], [4,5]],[1, 1, 1, 2, 1],[1, 1]),-1) I wonder whether the answer should be 4, the last city? Why? Well, I think the first four cities' armies arrive at the same time, so they wipe each other out; then the last city, index 4, arrives and gets the gold mine. city[0] has to go 5 at a speed of 1 city[1] has to go 5 at a speed of 1 city[2] has to go 5 at a speed of 1 city[3] has to go 10 at a speed of 2 city[4] has to go 7 at a speed of 1, so it arrives last, but alone. What am I missing here?

  • bieshop777 Avatar

    goldMineRace([[1,6], [1,-4], [-4,1], [11,1], [4,5]],[1, 1, 1, 2, 1],[1, 1])

    How come the result of this is supposed to be -1? The first 4 cities arrive at the same time so they all lose out, leaving the last city, which arrives the slowest to win it. Am I understanding the problem wrongly somehow?

  • user8436785 Avatar

    Simple Fun #222

    Great number ;-)

  • Vlatiha Avatar

    "Sample Test" and "Attempt" uses completely different data types, so you can make only one of them compile.

  • hobovsky Avatar

    Probably it's just me, but all this talk about continents, cities and coordinates gave me initial impression that it's about geodesic coordinates, and not cartesian :)

    • JohanWiltink Avatar

      It's just you. :P

      I looked up geodesic ( normal ) coordinates on Wikipedia, and ran away screaming. I still have no idea what they are. Do they even have [x,y] ?

    • hobovsky Avatar

      ah language playing tricks on me again :/ I meant geographic coordinates.

  • JohanWiltink Avatar

    Is the last example correct?

    Armies from cities 0 and 1 have higher speeds than those from cities 2 and 3. Seems like they should arrive earlier rather than later. Final outcome is still -1.

    • hobovsky Avatar

      It's correct, they're fast, but also far away. ETA for all cities is 1000 time units.

    • FArekkusu Avatar

      Already answered.

      Question marked resolved by FArekkusu 7 years ago
    • JohanWiltink Avatar

      Last example in the description .. all cities at distance 5 ?!?

    • hobovsky Avatar

      Ah ok, I thought you were talking about sample tests.

      But the cities from the description, still: first two armies arrive to the mine at the same time and kill off each other. Two slower armies come some time later, but also at the same moment, and also fight. Two battles. Everyone dies. No survivors.

      But I think the order of battles is mixed up. Armies 0 and 1 fight first, and 2 and 3 fight later.

  • JohanWiltink Avatar

    Haskell translation

    This deserves more attention. :]