This is the solution to this UVa problem . Note: In this problem you need to be very careful with the update of the rank list
Find tons of competitive coding stuff here. I usually code in C++ and Python and rarely in Java during competitive coding. This blog is still under construction!