Subtask 1:

  • Maintain an array for the leaderboard
  • For sorting, use the win rate and id of a team.
  • Sort the array every time there is any update (operation 1)
  • Traverse the whole array and calculate rank of every team for operation 2 and 3

Subtask 2:

  • Same as subtask 2 but do not sort the array for updates
  • Observe that only 2 team's info is changed for every update
  • So just remove the 2 teams and insert again in O(n)

Subtask 3:

Maintain a PBDS( Policy based data structure) for the leaderboard and the current information for each team.

For sorting, use the win rate and id of a team.

Operation 1 : Erase the teams from the pbds and insert again with new information.

Operation 2: Using the win rate of the given team, perform a binary search on the leaderboard to find out the number of teams with higher ranks.

Operation 3: Get the team in rank postion of the pbds. Find out the rank of that team. If it is equal to the given rank, it is the desired team. Otherwise print -1.

Statistics

30% Solution Ratio
jamil314Earliest, Nov '20
nusuBotFastest, 0.5s
fsshakkhorLightest, 9.2 MB
jamil314Shortest, 2237B
Toph uses cookies. By continuing you agree to our Cookie Policy.