Your code tries to match x and y hit times separately, but they need to happen at the same time. Solving both equations together fixes it.