ELOMAX (Ratings and Rankings) help

Logic -

  • Each row of matrix (N x M+3) will store the ratings at the end of M months, month of highest rating achieved, best ranking achieved, month of best ranking.

  • For each row, find the max rating of each participant and store in (M+1)th column.

  • Sort each month (column) row wise in descending order of rating. Find the ranks of each participant at the end of first month and store in (M+2)th column.

  • For subsequent months (column) after sorting row wise find ranks of each participant (row) and replace it with the rank in (M+2)th column only if the current rank is better (less). Then store that month in (M+3)th column.

This solution is not working except the example test cases of the question -

Simple idea is.
Store the max rating month wise.
Then create a ranking table.
Using the ranking table find the best ranking’s month and compare it with max rating month. If they are different increase the count
Link to my solution

Thanks @shim98. I did a similar approach. But can not figure out what is wrong in my code. Its giving WA.

Where are you finding the max rating month in your code?
(I edited please check that)

I havent seen your solution but I was struggling to the get the correct answer because of a very silly mistake and maybe it can help you.Consider one player and go through the ranks and ratings of the player for each month.If the ratings become peak for the first time and the rank also becomes peak for the first time after a month,dont consider that player.For example his ratings are 2500,2300,2400,2500 and his ranks are 2,2,3,1 then his peak rating and peak ranking does not occur in the same month.Rest all you have to do is find the month of peak rating(j1) and month of peak ranking(j2) and check for equality.If not equal count++.Make sure you are getting the correct rank with repetition of values.I think then you are good to go.Link to my solution https://www.codechef.com/viewsolution/37300717 hope it will help you.

While taking the input of ratings of each person, I was checking max rating and storing the month.

Thanks a lot for this explanation

1 Like