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. bzoj 3171 [Tjoi2013]循环格(MCMF)

    [题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=3171 [题意] 给定一个方向矩阵,要求改变最少的格子,使得任意一个点都在一个环中. [ ...

  2. 关于OpenCV做图像处理内存释放的一些问题

    转载:http://blog.sina.com.cn/s/blog_67a7426a0101czyr.html 工程运行,发现内存持续增长,到一定的时候就发生了内存泄漏. 内存泄露的定义 内存泄露是说 ...

  3. phonegap WebApp

    打开网页浏览器,进入Android SDK网站(http://developer.android.com/sdk/index.html). 我们可以看到,Google官方提供了包括Windows平台在 ...

  4. JDBC学习笔记(4)——PreparedStatement的使用

    PreparedStatement public interface PreparedStatement extends Statement;可以看到PreparedStatement是Stateme ...

  5. POJ 2349 Arctic Network (最小生成树)

    Arctic Network 题目链接: http://acm.hust.edu.cn/vjudge/contest/124434#problem/F Description The Departme ...

  6. 什么是USBMini接口

    USB的接口有四种.一种是大头,有A型和B型两种,其中A型最常见,就是我们用的最多的标准的USB接头:一种是小头的,也就是USB Mini,也有A型和B型两种,其中B型应用最多,主要应用于手机.MP4 ...

  7. thymeleaf条件表达式

    条件表达式形式:condition, then and else <tr th:class="${row.even}? 'even' : 'odd'"> ... < ...

  8. HDU 2586 How far away ? (LCA)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2586 LCA模版题. RMQ+LCA: #include <iostream> #incl ...

  9. HR(人事管理)

    HRMS(Human Resource Management System) --人员 per_people_f --人员分配 per_all_assignments_f --要素 DECLARE l ...

  10. Python3.5.2官方文档学习备忘录

    网址:https://docs.python.org/3/ 虽然学习官方文档有些耗时,不过看最原版的还是感觉好一点,原汁原味没有曲解没有省略. 从命令行向Python传递参数,运行:python - ...