OK what is happening with “Greater delta”??? The A clearly moves 4 spots, then it suddenly moves 1 spot? This is extremely confusing.
OH time is a part of it. ok
So after 5 mins including time differences, I figured it out.
Yeah it wouldn’t make sense to provide three different times as input if you’re not supposed to use them
I wouldn’t disagree, and to be honest I rushed this one due to it being late. But that being said, many many puzzles have unused information. Or at least information gathered from other means work. But you’re not wrong.
Hi, I passed all the test and all validators except the last “Validator 10”… I didnt hard code any thing to pass the last test case, Not able to debug too … can anyone help me? Coding language: Python
If you round down with int, try with math.floor instead.
It’s hard to tell what you did wrong without seeing your code but here are a few things to consider :
-
Use floats and not integers to compute the coordinates
-
Use floor on the final result, not int() as it will cause rounding issues
-
Make sure you discard asteroids that are outside the picture (x<0,y<0,x>=W,y>=H)
-
Make sure you only output the closest asteroid in case more than one have the same coordinates (A being the closest)
I used int
and my solution passed all the validators.
It might never been encountered in your solution if you pre-check if indexes are positive but there’s a potential source of error because of this subtle difference:
int(-0.5) = 0
math.floor(-0.5) = -1
I compare to the indexes then I truncate if necessary.
most likely you are using elif, but you should if if
I was using math.floor and not rounding down with int.
After getting in touch with the puzzle creator, I got to know that I over complicated the math and hence it was failing… after changing it to simple math it worked
Thanks for the suggestion though, and I know its hard to comment on some else code without seeing it. Its a blind shot.
Hey thanks for your reply, but its altogether a simple fix
the “A” one because its says : A being the closest and Z the farthest from your observation point
wow, enjoying ,
Couldn’t solve it, is this really an easy puzzle!? I can’t figure out how to implement the time difference correctly. My current solution works when the time is sequential, i.e 1, 2, 3 but breaks when it’s something like 1, 5, 6.
It seems your problem is about Math, not with coding. Look up tutorials about Ratios and Proportions. This puzzle is easy because it involves only linear equations.
The only troublesome factor may happen when you have to simplify float-point numbers into integers.
Try to solve small examples on paper first.
Try to solve this one:
t1, t2, t3 = 1, 5, 8
x1, x2, x3 = 2, 14, ?
y1, y2, y3 = 12, 4, ?
Hint: for dt = 4 you got dx = 12, what would be the dx for dt = 1? And for dt = 3?
Hey! Completed all the tests but it still report me that test 10 is missing when I submit, any clue? I would like to ckeck others (and cleaner :p) solutions Thank you!
Maybe a rounding issue?
When computing the speed, are you using euclidean distance or are you computing it for each axis separately ?