PROBLEM LINKSDIFFICULTYMEDIUM EXPLANATIONNotice the following 2 observations Using the first we can calculate the final positions by just adding or subtracting the time from the initial positions depending on the direction being South or North. Combining this with 2, we can easily see that if we sort the final positions, we will get the position of the the respective postman. But we also have to calculate the collisions. For that we can do the sorting of the positions using Bubble Sort where each swapping of adjacent numbers in the array means a collision. And, hence we can easily count the same. SETTER'S SOLUTIONCan be found here. TESTER'S SOLUTIONCan be found here.
This question is marked "community wiki".
asked 22 Nov '12, 18:36
