6 kyu
Simple Fun #222: Gold Mine Race
62 of 76myjinxin2015
Loading description...
Algorithms
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
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?
see below
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?
armies can also move diagonally
Thanks I thought of it after asking the question lol. Just a minor adjustment from my previous thinking.
Great number ;-)
"Sample Test" and "Attempt" uses completely different data types, so you can make only one of them compile.
don't forget to provide the language, plz (=> Haskell), so that the author/translators can track the problem more easily.
Sorry, forgot to tell. Yes, it's Haskell.
I have informed the translator to check the problem. Thank you for your feedback ;-)
My sincere apologies. Should be fixed now; please confirm.
Compiles okay now. Thanks.
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 :)
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]
?ah language playing tricks on me again :/ I meant geographic coordinates.
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
.It's correct, they're fast, but also far away. ETA for all cities is 1000 time units.
Already answered.
Last example in the description .. all cities at distance 5 ?!?
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.
Haskell translation
This deserves more attention. :]
.
Thanks!