NBUT-2014暑期集训专题练习1 -> 二分法E - E
来源:互联网 发布:完美告白知乎 编辑:程序博客网 时间:2024/06/01 14:20
Description
Li Ming is a good student. He always asks the teacher about his rank in his class after every exam, which makes the teacher very tired. So the teacher gives him the scores of all the student in his class and asked him to get his rank by himself. However, he has so many classmates, and he can’t know his rank easily. So he tends to you for help, can you help him?
Input
The first line of the input contains an integer N (1 <= N <= 10000), which represents the number of student in Li Ming’s class. Then come N lines. Each line contains a name, which has no more than 30 letters. These names represent all the students in Li Ming’s class and you can assume that the names are different from each other.
In (N+2)-th line, you'll get an integer M (1 <= M <= 50), which represents the number of exams. The following M parts each represent an exam. Each exam has N lines. In each line, there is a positive integer S, which is no more then 100, and a name P, which must occur in the name list described above. It means that in this exam student P gains S scores. It’s confirmed that all the names in the name list will appear in an exam.
In (N+2)-th line, you'll get an integer M (1 <= M <= 50), which represents the number of exams. The following M parts each represent an exam. Each exam has N lines. In each line, there is a positive integer S, which is no more then 100, and a name P, which must occur in the name list described above. It means that in this exam student P gains S scores. It’s confirmed that all the names in the name list will appear in an exam.
Output
The output contains M lines. In the i-th line, you should give the rank of Li Ming after the i-th exam. The rank is decided by the total scores. If Li Ming has the same score with others, he will always in front of others in the rank list.
Sample Input
用个map存下讯息,string->int,然后每次考试后的成绩是累加的,就是我划线的地方。这个要注意。其他没什么,用个迭代器遍历map就ok了
0 0
- NBUT-2014暑期集训专题练习1 -> 二分法E - E
- NBUT-2014暑期集训专题练习1 -> 二分法 A题
- NBUT-2014暑期集训专题练习1 -> 二分法 J - J
- NBUT-2014暑期集训专题练习1 -> 二分法 H - H
- NBUT-2014暑期集训专题练习1 -> 二分法B - B
- NBUT-2014暑期集训专题练习1 -> 二分法L - L
- NBUT-2014暑期集训专题练习1 -> 二分法F - F
- NBUT-2014暑期集训专题练习1 -> 二分法 N - N
- nbut线段树专题E - Just a Hook
- 暑假集训——贪心专题——E题
- 练习1-e
- 【搜索入门专题1】E
- 【字符串入门专题1】 E
- hpu暑期训练:E
- 2013秋13级预备队集训练习1 E - Kindergarten Counting Game
- 2013秋13级预备队集训练习3 --E - The ? 1 ? 2 ? ... ? n = k problem
- NBUT 2012 Summer Training -1 / [E] Exchange Rate
- 二分法l例 E
- POJ 2777 Count Color
- NOJ [1120] Reimu\'s Teleport
- POJ Maximum sum
- NOJ [1132] Evil Wheel
- NBUT-2014暑期集训专题练习1 -> 二分法 A题
- NBUT-2014暑期集训专题练习1 -> 二分法E - E
- NBUT-2014暑期集训专题练习1 -> 二分法 J - J
- NBUT-2014暑期集训专题练习1 -> 二分法 H - H
- NBUT-2014暑期集训专题练习1 -> 二分法B - B
- NBUT-2014暑期集训专题练习1 -> 二分法L - L
- NBUT-2014暑期集训专题练习1 -> 二分法F - F
- nbut线段树专题E - Just a Hook
- nbut线段树专题F - A Simple Problem with Integers
- nbut线段树专题I - Balanced Lineup