Description

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.

Input

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.

Output

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.

Sample Input

Input
5
vasya 100
vasya 200
artem 100
kolya 200
igor 250
Output
4
artem noob
igor pro
kolya random
vasya random
Input
3
vasya 200
kolya 1000
vasya 1000
Output
2
kolya pro
vasya pro
#include<iostream>
#include<cstdio>
#include<map>
#include<string>
using namespace std;
int main()
{
int i,j,k,n,x,sum,cnt;
string str;
map<string,int> score;
map<string,string> cate;
// scanf("%d",&n);
cin>>n;
while(n--)
{
cin>>str>>x;
if(score[str]<x)
score[str]=x;
}
map<string,int>::iterator it,it2;
cnt=score.size();
for(it=score.begin();it!=score.end();it++)
{
sum=;
for(it2=score.begin();it2!=score.end();it2++)
{
if(it->second<it2->second)
sum++;
}
double p=sum*1.0/cnt;
if(p>0.5)
cate[it->first]="noob";
else if(p>0.2&&p<=0.5)
cate[it->first]="random";
else if(p>0.1&&p<=0.2 )
cate[it->first]="average";
else if(p>0.01&&p<=0.1)
cate[it->first]="hardcore";
else
cate[it->first]="pro";
}
cout<<cnt<<endl;//忘记输出
for(map<string,string>::iterator tt=cate.begin();tt!=cate.end();tt++)
{
cout<<tt->first<<" "<<tt->second<<endl;
}
return ;
}

B - Plane of Tanks: Pro的更多相关文章

  1. Codeforces Round #115 B. Plane of Tanks: Pro 水题

    B. Plane of Tanks: Pro Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/17 ...

  2. 【codeforces 175D】 Plane of Tanks: Duel

    http://codeforces.com/problemset/problem/175/D (题目链接) 题意 A,B两人玩坦克大战,坦克有生命值,射击间隔,伤害范围,未命中的概率.问A赢的概率是多 ...

  3. Enterprise Solution 3.1 企业应用开发框架 .NET ERP/CRM/MIS 开发框架,C/S架构,SQL Server + ORM(LLBL Gen Pro) + Infragistics WinForms

    行业:基于数据库的制造行业管理软件,包含ERP.MRP.CRM.MIS.MES等企业管理软件 数据库平台:SQL Server 2005或以上 系统架构:C/S 开发技术 序号 领域 技术 1 数据库 ...

  4. vs生成pro

    1.修改.vcxproj文件   <PropertyGroup Label="Globals">    <ProjectGuid>{AAAA4039-13B ...

  5. 高级渲染技巧和代码示例 GPU Pro 7

    下载代码示例 移动设备正呈现着像素越来越高,屏幕尺寸越来越小的发展趋势. 由于像素着色的能耗非常大,因此 DPI 的增加以及移动设备固有的功耗受限环境为降低像素着色成本带来了巨大的压力. MSAA 有 ...

  6. 解析大型.NET ERP系统数据访问 对象关系映射框架LLBL Gen Pro

    LLBL Gen Pro是一个为.NET开发人员设计的的对象关系映射(ORM)框架,与NHibernate,Entity Framework等框架一样,通过实体与数据表的映射,实现关系数据库持久化. ...

  7. LLBL Gen Pro 5.0 企业应用开发入门

    Solutions Design 公司于2016年5月发布了LLBL Gen Pro 5.0,这个新版本的发布出乎于我的意料.我的猜想是从4.2升级到4.5,再升级5.x版本,主版本号的变更会给原有客 ...

  8. adobe premiere pro cc2015.0已停止工作 解决办法

    adobe premiere pro cc2015.0已停止工作 一直报错 解决办法就是: 删除我的电脑  我的饿文档下的 Adobe下的Premiere Pro文件夹 现象就是怎么重新安装都不管用P ...

  9. 使用powershell批量添加Qt的文件(生成pro)

    想使用QtCreator作为编辑器编辑keil或者IAR的工程,需要生成.pro文件,于是使用powershell批量处理. 源码如下: $incPath = dir -filter "*. ...

随机推荐

  1. mysql 游标最后一行 重复问题

    BEGINdeclare p_id INT;declare p_Code INT default 0;declare p_Logo INT default 0;declare p_Name varch ...

  2. [apkAnalyzer] 查看APK包名

    最近项目中要用到APK的包名,必应到apkAnalyzer这个软件可以用,下载解压后,看到这么些jar,bat文件不知道怎么用. 参考了这篇文章,看的也不甚明白,最后还是试出来了,这里记录一下. 首先 ...

  3. lucene学习笔记:三,Lucene的索引文件格式

    Lucene的索引里面存了些什么,如何存放的,也即Lucene的索引文件格式,是读懂Lucene源代码的一把钥匙. 当我们真正进入到Lucene源代码之中的时候,我们会发现: Lucene的索引过程, ...

  4. jxse2.6连接外网rdv一直连接不上,而相同的代码用jxse2.7却能连上

    一直以为2.6中的bug会少一些,所以用2.6做开发:之前测试一直是在同一台 机器上,所以没啥问题:最近在外网设置了一个rdv,却一直连不上,困扰了n久,尝试各种方式都不起作用.最后想起以前开发的代码 ...

  5. 注意 sizeof 中不要有复杂运算操作

    http://github.tiankonguse.com/blog/2014/12/05/c-base/ 一个比较有意思的问题 #include<stdio.h> ; int f() { ...

  6. POJ 1847 Tram (最短路)

    Tram 题目链接: http://acm.hust.edu.cn/vjudge/contest/122685#problem/N Description Tram network in Zagreb ...

  7. POJ 1308 Is It A Tree? (并查集)

    Is It A Tree? 题目链接: http://acm.hust.edu.cn/vjudge/contest/123393#problem/M Description A tree is a w ...

  8. mongod的主要参数解释

    mongod的主要参数有:

  9. ajax乱码问题 服务端 客户端 两种的解决方案--转载

    今天弄了一天的Ajax中文乱码问题,Ajax的乱码问题分为两种: 1. JavaScript输出的中文乱码, 比如:alert("中文乱码测试"); 2. 这第二种就是Ajax从服 ...

  10. c# 如何使用DLL的config文件中的信息

    我知道用c#编写的exe程序可以读取config文件中的配置信息,比如Test.exe,可以在与Test.exe相同目录下放置一个config文件:Test.exe.config,用System.Co ...