CF175B.Plane of Tanks: Pro

普及/提高-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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.

瓦西娅一整年都在和朋友们玩《坦克世界》(Plane of Tanks)。现在,需要根据玩家的成绩将他们划分为若干等级。

每位玩家在每轮《坦克世界》中获得一个非负整数分数。瓦西娅记录了过去一年中每一轮的比赛结果,共 $ n $ 条记录。

为确定某位玩家的等级,需考察该玩家的最佳成绩,以及所有其他玩家的最佳成绩。该玩家所属等级定义如下:

  • “菜鸟”(noob) —— 若超过 50% 的玩家成绩优于他;
  • “随机玩家”(random) —— 若他的成绩不劣于 50% 玩家所达到的成绩,但仍有超过 20% 的玩家成绩优于他;
  • “普通玩家”(average) —— 若他的成绩不劣于 80% 玩家所达到的成绩,但仍有超过 10% 的玩家成绩优于他;
  • “硬核玩家”(hardcore) —— 若他的成绩不劣于 90% 玩家所达到的成绩,但仍有超过 1% 的玩家成绩优于他;
  • “职业玩家”(pro) —— 若他的成绩不劣于 99% 玩家所达到的成绩。

计算百分比时,包含该玩家自身。例如:若仅有两名玩家参与游戏,第一名得分为 100,第二名得分为 1000,则第一名的成绩不劣于 50% 玩家的成绩,而第二名的成绩不劣于 100% 玩家的成绩。

瓦西娅向你提供了过去一年《坦克世界》的所有比赛结果。请帮助瓦西娅判定每位玩家的等级。

输入格式

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.

第一行包含唯一的一个整数 $ n (( 1 \leq n \leq 1000 $)—— 表示记录玩家成绩的条数。

接下来的 $ n $ 行中,每行包含一个玩家的姓名以及该玩家在本轮比赛中获得的分数,二者以空格分隔。姓名长度不少于 1 个字符、不超过 10 个字符,且仅由小写拉丁字母组成。保证任意两个不同玩家的姓名互不相同。每位玩家在本轮比赛中获得的分数是一个非负整数,且不超过 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.

第一行输出整数 m —— 至少参加过一轮比赛的玩家人数。

接下来的 m 行中,每行应包含一个玩家姓名及其所属类别,两者之间用空格分隔。类别只能是以下之一:“noob”、“random”、“average”、“hardcore” 或 “pro”(不带引号)。每个玩家姓名仅能输出一次。玩家姓名及其对应类别可以以任意顺序输出。

输入输出样例

  • 输入#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".

在第一个例子中,Artem 的最佳成绩不劣于 25% 玩家的成绩(即他本人的成绩),因此他属于“菜鸟”类别。Vasya 和 Kolya 的最佳成绩不劣于 75% 玩家的成绩(包括他们自己和 Artem),因此他们属于“普通玩家”类别。Igor 的最佳成绩不劣于 100% 玩家的成绩(包括所有其他玩家及他自己),因此他属于“高手”类别。

在第二个例子中,两名玩家得分相同,因此他们的成绩均不劣于 100% 玩家的成绩,故均属于“高手”类别。

输入解题思路,AI测评打分。不知道怎么写?

首页