A8541 | Plane of Tanks: Pro
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
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:
- "noob" — if more than $50%$ of players have better results;
- "random" — if his result is not worse than the result that $50%$ of players have, but more than $20%$ of players have better results;
- "average" — if his result is not worse than the result that $80%$ of players have, but more than $10%$ of players have better results;
- "hardcore" — if his result is not worse than the result that $90%$ of players have, but more than $1%$ of players have better results;
- "pro" — if his result is not worse than the result that $99%$ of players have.
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.
Vasya gave you the last year Plane of Tanks results. Help Vasya determine each player's category.
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.
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:
- "noob" — if more than $50%$ of players have better results;
- "random" — if his result is not worse than the result that $50%$ of players have, but more than $20%$ of players have better results;
- "average" — if his result is not worse than the result that $80%$ of players have, but more than $10%$ of players have better results;
- "hardcore" — if his result is not worse than the result that $90%$ of players have, but more than $1%$ of players have better results;
- "pro" — if his result is not worse than the result that $99%$ of players have.
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.
Vasya gave you the last year Plane of Tanks results. Help Vasya determine each player's category.
输入格式
The first line contains the only integer number $n$ ( $1<=n<=1000$ ) — a number of records with the players' results.
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.
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.
输出格式
Print on the first line the number $m$ — the number of players, who participated in one round at least.
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.
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.
输入输出样例
输入 #1
5 vasya 100 vasya 200 artem 100 kolya 200 igor 250
输出 #1
4 artem noob igor pro kolya random vasya random
输入 #2
3 vasya 200 kolya 1000 vasya 1000
输出 #2
2 kolya pro vasya pro
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".
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".
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".
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted