Problem link (Contest) - https://www.codechef.com/LOCMAY17/problems/LOC172
I solved the above problem in C++ (C++14), but my Python (PYTH 3.4) solution is getting WA.
My Approach :-
- Store the end-points of Y - Coordinates of the range each robot in an array - “Coord”.
- Sort the array - “Coord”.
- Generate the new end-points using coordinate compression, so that the new coordinates lie in the range [0, 2*N], where N = Number of robots.
- Now, the max number of overlapping intervals is the required answer.
I’m unable to find the error in the Python code.
C++ (C++14) Code (AC) - https://www.codechef.com/viewsolution/13888744
Python (PYTH 3.4) Code (WA) - https://www.codechef.com/viewsolution/13888800