DOTAA2 - HELP NERUBAN
Neruban, the DotA gamer knows to play with some heroes. You are given the list of heroes that Neruban knows to play with. You are also given how accurate he can play, how fast he can play and how stupidly he can play with every hero. i.e. for each hero you are given 3 values Accuracy(a), Speed(v) and Stupidity(s). Neruban wants to rank the heroes according to the order with which he can play perfectly. So sort the heroes based on higher accuracy, higher speed and lower stupidity
For example a hero with a=10, v=1, s=100 is higher ranked than a hero with a=1,v=100,s=0, because first preference is given for the accuracy of the hero.
Similarly a hero with a=10, v=5, s=20 is higher ranked than a hero with a=10, v=4, s=40, because second preference is given for the speed of the hero.
A hero with a=10, v=3, s=10 is higher ranked than a hero with a=10, v=3, s=15, because stupidity of a player should be lower
If any two heroes have same accuracy, speed and stupidity, sort them based on their name alphabetically.
The first line consists of an integer n, the number of heroes. The next n lines describe each hero with 4 values - the name of the hero, accuracy, speed and stupidity.
Sort the heroes based on the above criteria and print the rank list.
Name of a hero <= 15 characters (all lower case)
goblinshredder 45 66 98
pudge 45 86 76
shadowfiend 99 98 2
invoker 45 86 75
AC in 3 goes.....dont forget to check the case where every parameter is same and then u have to compare the two strings...i got 2 WA due to this
@Abhinav , Mine got accepted , don't think there are any tricky test cases , just make sure your compare function is correct , there are many if-else branches to be made and even smallest of mistakes can show WA.
getting WA, any tricky case ?