B. Plane of Tanks: Pro

Time Limit: 20 Sec

Memory Limit: 256 MB

题目连接

http://codeforces.com/contest/175/problem/B

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

5
vasya 100
vasya 200
artem 100
kolya 200
igor 250

Sample Output

4
artem noob
igor pro
kolya random
vasya random

HINT

题意

给你n个数据,每个数据有名字和分数,但是只用考虑最高分数

如果这个人的分数比99%的人都高,那就是pro

。。。。(然后读题,读题

然后让你输出有多少个人,并且把每个人获得的称号输出

题解:

水题咯,直接n^2就好了~

代码:

#include<iostream>
#include<stdio.h>
#include<map>
#include<iostream>
using namespace std; map<string,int> H;
string s;
int p;
int main()
{
int n;scanf("%d",&n);
for(int i=;i<n;i++)
{
cin>>s>>p;
H[s]=max(p,H[s]);
}
map<string,int>::iterator it1;
cout<<H.size()<<endl;
for(it1=H.begin();it1!=H.end();it1++)
{
map<string,int>::iterator it2;
int p = ;
for(it2=H.begin();it2!=H.end();it2++)
if(it1->second>=it2->second)
p++;
p = p * / H.size();
if(p>=)cout<<it1->first<<" pro"<<endl;
else if(p>=)cout<<it1->first<<" hardcore"<<endl;
else if(p>=)cout<<it1->first<<" average"<<endl;
else if(p>=)cout<<it1->first<<" random"<<endl;
else cout<<it1->first<<" noob"<<endl;
}
}

Codeforces Round #115 B. Plane of Tanks: Pro 水题的更多相关文章

  1. Codeforces Round #367 (Div. 2) A. Beru-taxi (水题)

    Beru-taxi 题目链接: http://codeforces.com/contest/706/problem/A Description Vasiliy lives at point (a, b ...

  2. Codeforces Round #334 (Div. 2) A. Uncowed Forces 水题

    A. Uncowed Forces Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/604/pro ...

  3. Codeforces Round #353 (Div. 2) A. Infinite Sequence 水题

    A. Infinite Sequence 题目连接: http://www.codeforces.com/contest/675/problem/A Description Vasya likes e ...

  4. Codeforces Round #327 (Div. 2) A. Wizards' Duel 水题

    A. Wizards' Duel Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/591/prob ...

  5. Codeforces Round #146 (Div. 1) A. LCM Challenge 水题

    A. LCM Challenge 题目连接: http://www.codeforces.com/contest/235/problem/A Description Some days ago, I ...

  6. Codeforces Round #335 (Div. 2) B. Testing Robots 水题

    B. Testing Robots Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.codeforces.com/contest/606 ...

  7. Codeforces Round #335 (Div. 2) A. Magic Spheres 水题

    A. Magic Spheres Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.codeforces.com/contest/606/ ...

  8. Codeforces Round #306 (Div. 2) A. Two Substrings 水题

    A. Two Substrings Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/550/pro ...

  9. Codeforces Round #188 (Div. 2) A. Even Odds 水题

    A. Even Odds Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/318/problem/ ...

随机推荐

  1. 开源Jabber(XMPP) IM服务器介绍

    一.摘要 这是我粗略读了一遍Jabber协议和相关技术文章后的产物,有些地方不一定准确.在文章中引用的一些代码来自www.jabber.org上的文章. 二. 什么是Jabber    Jabber就 ...

  2. MYSQL内存

    全局内存(BASE MEMORY) 线程内存(MEMORY PER CONNECTION) max_conecctions:整个 MySQL 允许的最大连接数; max_user_connection ...

  3. excel 经验总结

    1.2007版excel表格中怎么将使用字母+数字下拉排序 比如:A201110300001怎么在excel表格中往下拉的时候变成A201110300002.A201110300003…… 方法: 因 ...

  4. cadence异型孔

    1:画route path的边框,画在board geometry的ncroute_path层上,可以用zcopy (暂时没用过)      没有的话可能:WARNING: No route path ...

  5. redis集群的搭建

    1.首先下载好软件包 #cd /opt/tzr/ #wget http://redis.googlecode.com/files/redis-2.6.11.tar.gz #mkdir /opt/tzr ...

  6. [Java Code] 时间维度循环生成代码片段

    public static void main(String[] args) throws ParseException { String str = "20140301"; St ...

  7. [Hive - LanguageManual] Create/Drop/Alter -View、 Index 、 Function

    Create/Drop/Alter View Create View Drop View Alter View Properties Alter View As Select Version info ...

  8. Codevs No.1163 访问艺术馆

    2016-05-31 20:48:47 题目链接: 访问艺术馆 (Codevs No.1163) 题目大意: 一个贼要在一个二叉树结构的艺术馆中偷画,画都处于叶子节点处,偷画和经过走廊都需要时间,求在 ...

  9. SRM 511 DIV1 500pt(DP)

    题目简述 给定n个数,两个人轮流取数,和之前两个人的取的数或起来,谁不能取数或者谁取到的数和之前的数或值为511谁输,问谁能够赢? 题解 刚开始的想法是直接搜,不过需要记录取过的值的状态,2^50显然 ...

  10. Java设计模式系列之观察者模式

    观察者模式 Observer的定义 观察者模式定义了一种一对多的依赖关系,让多个观察者对象同时监听某一个主题对象. 这个主题对象在状态上发生变化时,会通知所有观察者对象,让它们能够自动更新自己. 第一 ...