175B.md (3607B)
1 Source: https://codeforces.com/problemset/problem/175/B 2 3 B. Plane of Tanks: Pro 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 Vasya has been playing Plane of Tanks with his friends the whole year. Now it is time to divide the participants into several categories depending on their results. 22 23 A player is given a non-negative integer number of points in each round of the Plane of Tanks. Vasya wrote results for each round of the last year. He has *n* records in total. 24 25 In order to determine a player's category consider the best result obtained by the player and the best results of other players. The player belongs to category: 26 27 * "noob" — if more than 50% of players have better results; 28 * "random" — if his result is not worse than the result that 50% of players have, but more than 20% of players have better results; 29 * "average" — if his result is not worse than the result that 80% of players have, but more than 10% of players have better results; 30 * "hardcore" — if his result is not worse than the result that 90% of players have, but more than 1% of players have better results; 31 * "pro" — if his result is not worse than the result that 99% of players have. 32 33 When the percentage is calculated the player himself is taken into account. That means that if two players played the game and the first one gained 100 points and the second one 1000 points, then the first player's result is not worse than the result that 50% of players have, and the second one is not worse than the result that 100% of players have. 34 35 Vasya gave you the last year Plane of Tanks results. Help Vasya determine each player's category. 36 37 Input 38 39 The first line contains the only integer number *n* (1 ≤ *n* ≤ 1000) — a number of records with the players' results. 40 41 Each of the next *n* lines contains a player's name and the amount of points, obtained by the player for the round, separated with a space. The name contains not less than 1 and no more than 10 characters. The name consists of lowercase Latin letters only. It is guaranteed that any two different players have different names. The amount of points, obtained by the player for the round, is a non-negative integer number and does not exceed 1000. 42 43 Output 44 45 Print on the first line the number *m* — the number of players, who participated in one round at least. 46 47 Each one of the next *m* lines should contain a player name and a category he belongs to, separated with space. Category can be one of the following: "noob", "random", "average", "hardcore" or "pro" (without quotes). The name of each player should be printed only once. Player names with respective categories can be printed in an arbitrary order. 48 49 Examples 50 51 Input 52 53 ``` 54 5 55 vasya 100 56 vasya 200 57 artem 100 58 kolya 200 59 igor 250 60 ``` 61 62 Output 63 64 ``` 65 4 66 artem noob 67 igor pro 68 kolya random 69 vasya random 70 ``` 71 72 Input 73 74 ``` 75 3 76 vasya 200 77 kolya 1000 78 vasya 1000 79 ``` 80 81 Output 82 83 ``` 84 2 85 kolya pro 86 vasya pro 87 ``` 88 89 Note 90 91 In the first example the best result, obtained by artem is not worse than the result that 25% of players have (his own result), so he belongs to category "noob". vasya and kolya have best results not worse than the results that 75% players have (both of them and artem), so they belong to category "random". igor has best result not worse than the result that 100% of players have (all other players and himself), so he belongs to category "pro". 92 93 In the second example both players have the same amount of points, so they have results not worse than 100% players have, so they belong to category "pro".