Pro.ID21665 TitlePublish or perish Title链接http://10.20.2.8/oj/exercise/problem?problem_id=21665 AC2 Submit19 Ratio10.53% 时间&空间限制描述Paper quality and quantity have long been used to measure a research's scientific productivity and scientific impact. Citation, which is the total times a paper has been cited, is a common means to judge importance of a paper. However, with all these factors varying, a collegiate committee has problems when judging which research is doing better. For this reason, H-index is proposed and now widely used to combine the above factors and give accurate judgment. H-index is defined as:
In other words, a scholar with an index of h has published h papers each of which has been cited by others at least h times. Note that H-index is always an integer. It's said that achieving H-index of 18 means one is fully qualify to be a professor, and H-index of 45 or higher could mean membership in the United States National Academy of Sciences. You are to calculate the H-index for all the researches in the list, base on the given information. 输入There are multiple scenarios in the input, terminated by a single zero (0). Each of the scenarios begin with an integer N ( 1 ≤ N ≤ 100 ), means that there are N papers. N lines follow, each contain a string (not exceeding 20 characters long), representing the author of the corresponding paper, without white spaces in-between. Though it would be common for one paper written by several authors, there would be exactly one author of each of these papers. Finally, there are N lines of strings, containing '0's and '1's. If the j-th character in the i-th line is '1' it means the i-th paper cites the j-th paper. A paper could never cite itself. 输出Description Paper quality and quantity have long been used to measure a research's scientific productivity and scientific impact. Citation, which is the total times a paper has been cited, is a common means to judge importance of a paper. However, with all these factors varying, a collegiate committee has problems when judging which research is doing better. For this reason, H-index is proposed and now widely used to combine the above factors and give accurate judgment. H-index is defined as:
In other words, a scholar with an index of h has published h papers each of which has been cited by others at least h times. Note that H-index is always an integer. It's said that achieving H-index of 18 means one is fully qualify to be a professor, and H-index of 45 or higher could mean membership in the United States National Academy of Sciences. You are to calculate the H-index for all the researches in the list, base on the given information. Input There are multiple scenarios in the input, terminated by a single zero (0). Each of the scenarios begin with an integer N ( 1 ≤ N ≤ 100 ), means that there are N papers. N lines follow, each contain a string (not exceeding 20 characters long), representing the author of the corresponding paper, without white spaces in-between. Though it would be common for one paper written by several authors, there would be exactly one author of each of these papers. Finally, there are N lines of strings, containing '0's and '1's. If the j-th character in the i-th line is '1' it means the i-th paper cites the j-th paper. A paper could never cite itself. Output For each scenario, output as many lines as the number of authors given. Each line contains the author's name and his H-index. The list should be sorted first by H-index in descending order, than by name in alphabetic order (Actually, ASCII order. So 'B' is prior to 'a'). Output a blank line after each scenario. Sample Input 4 Sample Output Peter 2 Source 样例输入4 样例输出Peter 2 作者 |