Please subscribe to the official Codeforces channel in Telegram via the link: https://t.me/codeforces_official. ×

Abhizen's blog

By Abhizen, history, 3 weeks ago, ,

I have solved this problem Taxi drivers and Lyft using two approaches. My first solution does not pass test case 5 where as second solution passes all test cases. Test case 5 is pretty big to figure out the mistake. Please help me figure out what is the problem with my first approach.

1. By iterating over people array and storing distance of next taxi driver in a separate array. Then I am iterating again on people array to count riders for each taxi based on distance between taxi driver and rider. First solution
2. By iterating over people array and storing taxi driver coordinate and rider coordinate in separate array. Then I am iterating over rider coordinate array and iterate over taxi driver coordinate array in nested loop based on distance between rider and taxi driver. Second solution

 » 3 weeks ago, # | ← Rev. 2 →   +3 1 4 2 4 6 7 12 1 1 0 1 1 Try this test for first solution
•  » » 3 weeks ago, # ^ |   0 Got it. Thanks a lot!!